JS TutorialLesson #214

Temporal Standards

Temporal is based on the following standards:

Temporal is based on the following standards:

NameDescription
ISO 8601 Date/TimeInternational standard
ISO 8601 DurationISO 8601 duration codes
RFC 3339 Date/TimeInternet standard
RFC 9557 Date/TimeTemporal standard
RFC 5545 iCalendarThe iCalendar data format
JavaScript CalendarsInternet calendar systems

Share

The ISO 8601 Standard

ISO 8601 is the International Standard for representing dates and times.

It is a machine-readable text format in the form YYYY-MM-DDThh:mm:ssZ.

ISO 8601 was designed to eliminate confusion caused by regional date variations.

It follows a "largest to smallest" hierarchy (year, month, day, hour, minute, second) which ensures that dates are alphabetically sortable.

Note > ISO 8601 avoids confusion between regional formats like: > MM/DD/YYYY (US format) > DD/MM/YYYY (European format)

ISO 8601 Strings

An ISO 8601 string represents dates and times in a structured and sortable format:

FormatDescription
YYYYA 4-digit year
MM2-digit month
DD2-digit day
TSeparator for time
hhHour
mmMinute
ssSecond
ZZero (Zulu) time Zone

Examples

FormatFormatExample
Date (4-digit year)YYYY-MM-DD2026-05-17
Time (24 hour)hh:mm:ss14:30:00
Date & TimeYYYY-MM-DDThh:mm:ssZ2026-05-17T14:30:00Z
Date & Time UTCYYYY-MM-DDThh:mm:ssZ2026-05-17T14:30:00Z
Date & Time + OffsetYYYY-MM-DDThh:mm:ss±hh:mm2026-05-17T14:30:00+01:00
Week DateYYYY-Www-D2026-W20-7
Ordinal (001-366)YYYY-nnn2026-074

ISO 8601 Duration Codes

An ISO 8601 duration represent lengths of time.

It uses a standard format starting with ±P (Period), followed by the structure nYnMnDTnHnMnS.

CodeDescription
±Optional positive/negative duration (default is +).
PDuration designator (for period)
nYNumber of calendar years
nMNumber of calendar months
nWNumber of weeks
nDNumber of calendar days
TTime designator (precedes time components)
nHNumber of hours
nMNumber of minutes
nSNumber of seconds

Syntax

Example Code

javascript
Try it Yourself
±P nY nM nW nD T nH nM nS

Example

Example Code

javascript
Try it Yourself
P3Y6M4DT12H30M5S

More Examples

DurationCode
1 DayP1D
45 MinutesPT45M
1 Year, 2 Months, 3 DaysP1Y2M3D
4 Hours, 5 Minutes, 6 SecondsPT4H5M6S
2.5 HoursPT2H30M
5 WeeksP5W

Usage Rules

  • Time Separator If you have hours, minutes, or seconds, you must use the T separator, or the code will be invalid (e.g. PT3H not P3H).
  • Optionality Components are optional, but at least one must be present after P or T.
  • Order The order must be preserved: P-> Y-> M-> W-> D-> T-> H-> M-> S.
  • Decimal fractions You can use decimal points for the smallest unit, like PT0.0021S for 2.1 milliseconds.

The RF 3339 Format

RFC 3339 is the Internet Standard for Date and Time Formats.

It is a Subset of ISO 8601 designed for use in Internet protocols.

FeatureDescription
FormatFollows the ISO pattern YYYY-MM-DDThh:mm:ssZ
Time ZonesRequires a Z for time zone UTC or an offset (+05:00)
T SeparatorAllows the "T" separator to be replaced by " " for readability
Web APIsThe default format for timestamps in JSON and RESTful APIs
ProgrammingModern languages have bult-in support like toISOString()

The RFC 9557 Format

RFC 9557 is the primary format used by JavaScript Temporal to represent dates.

FeatureISO 8601RFC 3339RFC 9557
FormatYYYY-MM-DDThh:mm:ssZSameSame
UTC OffsetYesYesYes
IANA ZoneNoNo[America/New_York]
CalendarsISO onlyISO only[u-ca=hebrew]
CompabileThe StandardSubset of ISO 8601Extends 3339
RFC 9557 was created because ISO 8601 and RFC 3339 did not contain enough > information to determine the geographical time zone or handle future DST > (Daylight Saving Time) changes.

RFC 5545 iCalendar

RFC 5545 is the official internet standard for the iCalendar data format. It defines how calendar systems should store and share calendar data like meetings, tasks, and free/busy times using plain text files.

iCalendar is text-based. It Uses readable lines of text encoded in UTF-8.

iCalendar is is application independent. It works across different apps like Apple Calendar, Google Calendar, and Microsoft Outlook.

Examples

Example Code

javascript
Try it Yourself
BEGIN:VCALENDAR

VERSION:2.0

PRODID:-//Example Corp//NONSGML Calendar App//EN

CALSCALE:GREGORIAN

METHOD:PUBLISH

BEGIN:VEVENT

UID:uid123456789@example.com

DTSTAMP:20260810T120000Z

ORGANIZER;CN=John Doe:mailto:john.doe@example.com

DTSTART:20260812T140000Z

DTEND:20260812T150000Z

SUMMARY:Project Kickoff Meeting

DESCRIPTION:Initial team synchronization and roadmap review.

LOCATION:Conference Room A

STATUS:CONFIRMED

CLASS:PUBLIC

END:VEVENT

END:VCALENDAR
FieldDescription
BEGIN:VCALENDARRequired. Begins a calendar object.
VERSION:2.0Required. Specifies compliance with RFC 5545.
PRODIDRequired. -//Organization//Product//Language.
BEGIN:VEVENTRequired. Begins a single calendar event.
UIDA globally unique event identifier to prevent duplicates.
DTSTAMPThe exact date and time the file was generated.
ORGANIZERDefines who is hosting or managing the event.
DTSTARTEvent start time (YYYYMMDDTHHMMSSZ in UTC).
DTENDEvent end time (YYYYMMDDTHHMMSSZ in UTC).
SUMMARYThe title of the calendar event.
DESCRIPTIONThe detailed notes or body text of the event.
LOCATIONThe location of the event.
CLASSPUBLIC, PRIVATE or CONFIDENTIAL.
STATUSTENTATIVE, CONFIRMED or CANCELLED.
END:VEVENTRequired. Ends a single calendar event.
END:VCALENDARRequired. Ends a calendar object.

Calendar Systems in JavaScript

  • Temporal supports multiple calendar systems
  • The calendars are based on the Unicode CLDR standard
  • They are used with the Intl API.
  • The default is iso8601.
  • Calendars affect how dates are interpreted and displayed.
  • Use [u-ca=calendar] to specify a calendar.

Supported Calendar Identifiers

Calendar IDNameRegionDescription
iso8601ISO 8601WorldwideThe default calendar used by Temporal
gregoryGregorianWorldwideThe most widely used civil calendar today
buddhistBuddhistThailandA different year numbering system than Gregorian
chineseChineseChinaA lunisolar calendar used for traditional festivals
copticCopticEgyptUsed by the Coptic Orthodox Church
dangiDangiKoreaTraditional Korean lunisolar calendar
ethiopicEthiopicEthiopiaA calendar with 13 months
ethioaaEthiopic AAEthiopiaAlternative Ethiopic era
hebrewHebrewIsraelA lunisolar calendar used in Jewish traditions
indianIndian (Saka)IndiaThe official civil calendar of India
islamicIslamicMiddle EastA lunar calendar used in Islamic countries
islamic-umalquraUmm al-QuraSaudi ArabiaThe official Saudi calendar
japaneseJapaneseJapanBased on imperial eras
persianPersianIranA solar calendar with high accuracy
rocRepublic of ChinaTaiwanUsed in Taiwan (Minguo calendar)

Calendar Systems Explained

A calendar system defines how dates are calculated.

Different cultures use different calendars.


Solar Calendars

Based on the Earth's orbit around the sun.

  • Gregorian
  • ISO 8601
  • Persian

These calendars track seasons accurately.


Lunar Calendars

Based on the phases of the moon.

  • Islamic

Lunar calendars have shorter years.


Lunisolar Calendars

Combine solar and lunar cycles.

  • Chinese
  • Hebrew
  • Dangi

They adjust months to stay aligned with seasons.


Era-Based Calendars

Use eras instead of a continuous year count.

  • Japanese
  • ROC (Taiwan)

Using Calendars in Temporal

The from() method supports calendars using the [u-ca=calendar] syntax or a calendar property in objects.

Examples

Example Code

javascript
Try it Yourself
Temporal.PlainDate.from("2026-05-17[u-ca=japanese]")

Interactive Code Examples

Syntax

javascript
Try it Yourself
JavaScript syntax and algorithm demonstration.
±P nY nM nW nD T nH nM nS

JS Example 2

javascript
Try it Yourself
JavaScript syntax and algorithm demonstration.
P3Y6M4DT12H30M5S

Examples

javascript
Try it Yourself
JavaScript syntax and algorithm demonstration.
BEGIN:VCALENDAR



VERSION:2.0

PRODID:-//Example Corp//NONSGML Calendar App//EN

CALSCALE:GREGORIAN

METHOD:PUBLISH



BEGIN:VEVENT

UID:uid123456789@example.com

DTSTAMP:20260810T120000Z

ORGANIZER;CN=John Doe:mailto:john.doe@example.com

DTSTART:20260812T140000Z

DTEND:20260812T150000Z

SUMMARY:Project Kickoff Meeting

DESCRIPTION:Initial team synchronization and roadmap review.

LOCATION:Conference Room A

STATUS:CONFIRMED

CLASS:PUBLIC

END:VEVENT



END:VCALENDAR

Examples

javascript
Try it Yourself
JavaScript syntax and algorithm demonstration.
Temporal.PlainDate.from("2026-05-17[u-ca=japanese]")