|
7 | 7 | Each calendar month object has a `key` attribute ranging from 0 to 11 (January to December), a `name` attribute and a `data` attribute to generate each field in the calendar.
|
8 | 8 |
|
9 | 9 | ```typescript
|
| 10 | +type ValueName = { |
| 11 | + value: number, |
| 12 | + name: 'january' | 'febuary' | 'march' | 'april' | 'may' | 'june' | 'july' | 'august' | 'september' | 'october' | 'november' | 'december' |
| 13 | +} |
| 14 | + |
10 | 15 | interface CalendarMonth {
|
11 |
| - key: number, |
12 |
| - name: string, // january, febuary, march ... |
13 |
| - data: Record<number, Array<{ |
| 16 | + date: { |
| 17 | + object: Date, |
| 18 | + currentDate: 31, |
| 19 | + currentDay: 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat' | 'sun', |
| 20 | + currentMonth: ValueName, |
| 21 | + prevMonth: ValueName, |
| 22 | + nextMonth: ValueName, |
| 23 | + currentYear: 2022, |
| 24 | + prevYear: number, |
| 25 | + nextYear: number |
| 26 | + }, |
| 27 | + calendarValues: Record<number, Array<{ |
14 | 28 | type: string, //prev, next or current
|
15 | 29 | value: number,
|
16 | 30 | dateValue: string
|
17 | 31 | }>>
|
18 | 32 | }
|
19 | 33 | ```
|
20 | 34 |
|
21 |
| -### `data` |
| 35 | +### `calendarValues` |
22 | 36 |
|
23 |
| -The `data` attribute is an object with 6 keys ranging from 1-6. Each number indicates a row in the calendar. Each key (row) has an array of 7 data fields (columns) for the dates from Sunday to Saturday. |
| 37 | +The `calendarValues` attribute is an object with 6 keys ranging from 1-6. Each number indicates a row in the calendar. Each key (row) has an array of 7 data fields (columns) for the dates from Sunday to Saturday. |
24 | 38 |
|
25 | 39 | |Sun|Mon|Tue|Wed|Thu|Fri|Sat|
|
26 | 40 | |:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|
@@ -54,5 +68,17 @@ The `dateValue` attribute is the date string with the format `YYYY-MM-DD`.
|
54 | 68 | The `getCalendarYear` function returns the calendar year as an object with keys ranging from 0 - 11 (Jan - Feburary). The value corresponds to the data for the calendar month.
|
55 | 69 |
|
56 | 70 | ```typescript
|
57 |
| -type CalendarYear = Record<number, CalendarMonth> |
| 71 | +interface YearCalendarMonth { |
| 72 | + key: number, |
| 73 | + name: string, // january, febuary, march ... |
| 74 | + calendarValues: Record<number, Array<{ |
| 75 | + type: string, //prev, next or current |
| 76 | + value: number, |
| 77 | + dateValue: string |
| 78 | + }>> |
| 79 | +} |
| 80 | +``` |
| 81 | + |
| 82 | +```typescript |
| 83 | +type CalendarYear = Record<number, YearCalendarMonth> |
58 | 84 | ```
|
0 commit comments