JavaScript/The RFC 9557 format
[i]Learn· Representing dates & times

The RFC 9557 format

Dates are often passed between different systems, such as being stored in browser storage like IndexedDB, sent to your backend, etc. This requires a common serialization format. All Temporal objects implement the RFC 9557 format, based on ISO 8601 / RFC 3339. To convert an object to an RFC 9557 string, call its toString() method.

const bastilleFallStr = bastilleFall.toString();
console.log(bastilleFallStr); // 1789-07-14T17:09:21+00:09[Europe/Paris]

Times and dates are most commonly data fields of bigger objects. All Temporal objects include a toJSON() method, so they are automatically JSON-serialized to the same format when the bigger object is serialized using JSON.stringify().

const mdnRepoHistory = JSON.stringify({ creation: mdnCreation });
console.log(mdnRepoHistory); // {"creation":"2020-09-15T11:43:01-04:00[America/New_York]"}

RFC 9557 strings can be converted back to their respective objects by passing them to the from() method:

const bastilleFall2 = Temporal.ZonedDateTime.from(bastilleFallStr); // Another ZDT object

When you use JSON.parse(), you can use the reviver to parse the date fields:

const mdnRepoHistoryParsed = JSON.parse(mdnRepoHistory, (key, value) => {
  if (key === "creation") return Temporal.ZonedDateTime.from(value);
  return value;
});
// { creation: ZonedDateTime {...} }

Each class supports a different subset of the RFC 9557 format (for example, plain date-times won't output the offset or time zone ID); each class reference page has an "RFC 9557 format" section that details the format it uses.

Source: Representing dates & times by Mozilla Contributors, licensed under CC-BY-SA-2.5. Retrieved 2026-11-18. Changes: Extracted the section "The RFC 9557 format"; removed the code-block language labels; made links absolute.