Getter Methods
year
Signature
get year(): numberReturn Type
number - Full year (e.g., 2025)
Notes
- Returns the full 4-digit year
- Uses local time unless instance is UTC-based
Example
new Chronos('2025-01-01').year; // 2025month
Signature
get month(): 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11Return Type
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 - Month (0-11)
Notes
- 0 = January, 11 = December
- Consistent with JavaScript Date behavior
Example
new Chronos('2025-01-01').month; // 0 (January)date
Signature
get date(): NumberRange<1, 31>Return Type
NumberRange<1, 31> - Day of month (1-31)
Example
new Chronos('2025-01-15').date; // 15hour
Signature
get hour(): 0 | 1 | 2 | 3 | 4 | 5 | ... | 23Return Type
0 | 1 | 2 | 3 | 4 | 5 | ... | 23 - Hour (0-23)
Example
new Chronos('2025-01-01T14:30:00').hour; // 14minute
Signature
get minute(): 0 | 1 | 2 | 3 | 4 | 5 | ... | 59Return Type
0 | 1 | 2 | 3 | 4 | 5 | ... | 59 - Minute (0-59)
Example
new Chronos('2025-01-01T14:30:00').minute; // 30second
Signature
get second(): 0 | 1 | 2 | 3 | 4 | 5 | ... | 59Return Type
0 | 1 | 2 | 3 | 4 | 5 | ... | 59 - Second (0-59)
Example
new Chronos('2025-01-01T14:30:45').second; // 45millisecond
Signature
get millisecond(): MilliSecondReturn Type
MilliSecond - Millisecond (0-999)
Example
new Chronos('2025-01-01T14:30:45.123').millisecond; // 123weekDay
Signature
get weekDay(): 0 | 1 | 2 | 3 | 4 | 5 | 6Return Type
0 | 1 | 2 | 3 | 4 | 5 | 6 - Day of week (0-6)
Notes
- 0 = Sunday, 6 = Saturday
Example
new Chronos('2025-01-01').weekDay; // 0 (Sunday)isoWeekday
Signature
get isoWeekday(): 1 | 2 | 3 | 4 | 5 | 6 | 7Return Type
1 | 2 | 3 | 4 | 5 | 6 | 7 - ISO day of week (1-7)
Notes
- 1 = Monday, 7 = Sunday
Example
new Chronos('2025-01-01').isoWeekday; // 7 (Sunday)isoMonth
Signature
get isoMonth(): NumberRange<1, 12>Return Type
NumberRange<1, 12> - Month (1-12)
Notes
- 1 = January, 12 = December
Example
new Chronos('2025-01-01').isoMonth; // 1unix
Signature
get unix(): numberReturn Type
number - Unix timestamp in seconds
Example
new Chronos('2025-01-01').unix; // 1672531200timestamp
Signature
get timestamp(): numberReturn Type
number - Milliseconds since epoch
Example
new Chronos('2025-01-01').timestamp; // 1672531200000lastDateOfMonth
Signature
get lastDateOfMonth(): NumberRange<28, 31>Return Type
NumberRange<28, 31> - Last day of month (28, 29, 30 or 31)
Notes
- Accounts for leap years
Example
new Chronos('2025-02-01').lastDateOfMonth; // 28
new Chronos('2024-02-01').lastDateOfMonth; // 29