Countdown Module
The countdown module manages important date reminders.
Data Structure
interface CountdownItem {
id: string
name: string // Name
targetDate: string // Target date (YYYY-MM-DD)
repeatType: 'none' | 'monthly' | 'yearly' // Repeat type
repeatInterval: number // Repeat interval
createdAt: string
}
IPC Channels
| Channel | Parameters | Returns |
|---|---|---|
countdown-get-all | - | CountdownItem[] |
countdown-create | Partial<CountdownItem> | CountdownItem |
countdown-update | id, Partial<CountdownItem> | CountdownItem |
countdown-delete | id | boolean |
Date Calculation Logic
No Repeat
Directly calculates the difference between target date and today.
Monthly Repeat
Starting from the target date, increments by repeatInterval months to find the first date >= today.
Yearly Repeat
Starting from the target date, increments by repeatInterval years to find the first date >= today.
Sort Order
- Today (days === 0) first
- Future dates ascending by days
- Past dates last