Skip to content

🧲 Core Getters ​

The Tempo class provides an extensive array of zero-cost getters that allow you to seamlessly read properties from the underlying Temporal instance.

TIP

Zero-Cost Lazy Evaluation
Tempo uses a sophisticated proxy-based lazy-evaluation pattern. Accessing a getter (like t.yy) resolves the property on demand, and then overwrites the getter with a static literal. This means the first access is O(1) and every subsequent access is raw property access (O(0) cost).

⚡ Native Temporal Gateway ​

GetterTypeDescriptionExample
.zdtTemporal.ZonedDateTimeDirect zero-overhead access to the underlying native Temporal instancet.zdt.daysInMonth

The .zdt getter provides direct, zero-overhead access to the underlying Temporal.ZonedDateTime instance, enabling native Temporal inspections and properties without method call ceremony:

typescript
const t = new Tempo('2026-10-24T15:30:00[Australia/Sydney]');

console.log(t.zdt.daysInMonth);  // 31
console.log(t.zdt.inLeapYear);   // false
console.log(t.zdt.offset);       // '+11:00'
console.log(t.zdt.hoursInDay);   // 24
console.log(t.zdt.monthCode);    // 'M10'

📅 Date Properties ​

GetterTypeDescriptionExample
.yynumber4-digit Year2026
.mmnumberMonth number (1 = Jan, 12 = Dec)10
.ddnumberDay of the month (1-31)24
.dimnumberTotal days in the month (28-31; convenience alias for .zdt.daysInMonth)31
.jjnumberAstronomical Julian Day number since 4713 BC2461331
.erastringLocalized era string'ce', 'bce', 'ad', 'bc'
.eonnumberPositive integer year within the current .era2026, 4

NOTE

Days in Month (.dim) vs. Native .zdt.daysInMonth
While .dim is provided as a zero-cost convenience property returning the number of days in the current month (28–31, matching format token {dim} and PHP t), t.zdt.daysInMonth is the native standard property directly available on the underlying Temporal.ZonedDateTime instance.

NOTE

Astronomical Julian Day (.jj) vs. Day of Year (.doy)
.jj provides the true astronomical Julian Day Number (an integer day count elapsed since noon UT on January 1, 4713 BC in the proleptic Julian calendar, e.g. 2461331 for 2026-10-17), matching Oracle J and token {jj}. If you need the calendar day within the current year (1–366), use .doy (or format token {doy} / {dd:year}).

⏱️ Time Properties ​

GetterTypeDescriptionExample
.hhnumberHour of the day (0-23)15
.minumberMinutes of the hour (0-59)30
.ssnumberSeconds of the minute (0-59)45
.msnumberMilliseconds of the second (0-999)123
.usnumberMicroseconds of the millisecond (0-999)456
.nsnumberNanoseconds of the microsecond (0-999)789
.ffnumberFractional seconds representation0.123456789

🗓️ ISO Week & Day Alignments ​

GetterTypeDescriptionExample
.yownumber4-digit ISO week-numbering year2026
.woynumberISO week number of the year (1-53; canonical, supersedes legacy .ww)43
.downumberISO weekday number (1 = Mon, 7 = Sun)6
.doynumberDay of the year (1-366)297

NOTE

Canonical Getters & v5 Deprecation Path
To establish a clean, predictable, and collision-free API surface across getters and format tokens:

  • .woy is canonical for ISO week of the year. The legacy .ww getter is marked @deprecated and will be removed in v5.0.0.
  • .eon is canonical for the positive integer year within the era (supersedes @deprecated .eraYear).
  • .dd is canonical for the day of the month (supersedes @deprecated .day).

🔤 Named String Representations ​

GetterTypeDescriptionExample
.monstringFull English month name'October'
.mmmstringShort English month name'Oct'
.wkdstringFull English weekday name'Saturday'
.wwwstringShort English weekday name'Sat'

🌍 Regional, Timezone & System Properties ​

GetterTypeDescriptionExample
.tzstringIANA Time Zone ID'Australia/Sydney'
.calstringTemporal Calendar ID'iso8601'
.localestring | string[]Resolved BCP 47 locale'en-AU', ['en-US', 'fr-FR']
.intlTempoIntlNamespaceStructured internationalization namespace (.info for cultural metadata, .locale for native Intl.Locale)t.intl.info.firstDay, t.intl.locale
.geoobject | undefinedResolved geographic coordinates (latitude, longitude, elevation, sphere){ latitude: -33.8688, longitude: 151.2093 }
.sphere'north' | 'south' | undefinedResolved hemisphere configuration'south'
.tsnumber | bigintUnix timestamp (number for ss/ms/us, bigint for ns)1792843200000
.nanobigintNanoseconds since Unix epoch1792843200000000000n
.isostringStandard ISO 8601 string (RFC 3339) in UTC'2026-10-24T04:30:00Z'
.isValidbooleantrue if the underlying date-time is validtrue

🎛️ Metadata Properties ​

Beyond date-time properties, the Tempo class also provides read-only getters into its active state and configuration.

GetterTypeDescription
.configobjectReturns a proxy to the active configuration, including all resolved inheritance and local overrides.
.termsobjectReturns a dictionary of all registered TermPlugins and their available ranges.
.rangesobjectReturns a dictionary of the currently active range key for every registered term (e.g., { 'season': 'summer' }).
.parseobjectReturns a shadowed view of the internal parsing state (including anchor, mode, and the AST-like match output).

Released under the MIT License.