ChronosChronos

Getter Methods

Getter methods available on a Chronos instance.

year

Signature

get year(): number

Return 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; // 2025

month

Signature

get month(): 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11

Return 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; // 15

hour

Signature

get hour(): 0 | 1 | 2 | 3 | 4 | 5 | ... | 23

Return Type

0 | 1 | 2 | 3 | 4 | 5 | ... | 23 - Hour (0-23)

Example

new Chronos('2025-01-01T14:30:00').hour; // 14

minute

Signature

get minute(): 0 | 1 | 2 | 3 | 4 | 5 | ... | 59

Return Type

0 | 1 | 2 | 3 | 4 | 5 | ... | 59 - Minute (0-59)

Example

new Chronos('2025-01-01T14:30:00').minute; // 30

second

Signature

get second(): 0 | 1 | 2 | 3 | 4 | 5 | ... | 59

Return Type

0 | 1 | 2 | 3 | 4 | 5 | ... | 59 - Second (0-59)

Example

new Chronos('2025-01-01T14:30:45').second; // 45

millisecond

Signature

get millisecond(): MilliSecond

Return Type

MilliSecond - Millisecond (0-999)

Example

new Chronos('2025-01-01T14:30:45.123').millisecond; // 123

weekDay

Signature

get weekDay(): 0 | 1 | 2 | 3 | 4 | 5 | 6

Return 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 | 7

Return 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; // 1

unix

Signature

get unix(): number

Return Type

number - Unix timestamp in seconds

Example

new Chronos('2025-01-01').unix; // 1672531200

timestamp

Signature

get timestamp(): number

Return Type

number - Milliseconds since epoch

Example

new Chronos('2025-01-01').timestamp; // 1672531200000

epochSeconds

Signature

get epochSeconds(): number

Return Type

number - Seconds since epoch

Note

Same as unix getter method.

Example

new Chronos('2025-01-01').epochSeconds; // 1735689600

epochMilliseconds

Signature

get epochMilliseconds(): number

Return Type

number - Milliseconds since epoch

Note

Same as timestamp getter method.

Example

new Chronos('2025-01-01').epochMilliseconds; // 1735689600000

epochNanoseconds

Signature

get epochNanoseconds(): bigint

Return Type

bigint - Nanoseconds since epoch

Important

It does not return the actual nanoseconds, it converts milliseconds to nanoseconds bigint for working with Temporal.

Example

new Chronos('2025-01-01').epochNanoseconds; // 1735689600000000000n

lastDateOfMonth

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

Last updated: Tue, Jun 23, 2026 07:34:42PM (UTC)

On this page