Loading topic
Date looks like it holds a year, a month, a day, and a time. It holds none of those. It holds a single number: the count of milliseconds since the Unix epoch. Once you understand that number, most of the strange behavior of Date starts to make sense.2 min readDate holds one millisecond time value since the Unix epoch. Here you will see the ways to create a Date and the mistakes each way invites.2 min readDate from components and that a Date stores one instant as milliseconds since the Unix epoch. It also assumes you have a rough idea of what UTC and local time mean. Local and UTC getters get their own chapter later.2 min readDate holds one time value in milliseconds since the Unix epoch, and that you can create dates from components and ISO strings. It also assumes you know what UTC and a time-zone offset are.2 min readDate wraps a millisecond time value, and that a date-only ISO string is parsed as UTC while a date-time string with no offset is parsed as local time. Both topics were covered in earlier chapters. This chapter covers what happens when a date leaves your program2 min readDate holds one instant. Every Intl formatter you meet later in this tutorial (DateTimeFormat, RelativeTimeFormat, PluralRules, NumberFormat) is built with the same three-part pattern. Learn the2 min readDate stores one instant, how local time and UTC differ, and the Intl basics: locale tags, options objects, and resolvedOptions(). Every example passes timeZone: "UTC" so the output is the same on any machine. The next chapter explains time zones in full.2 min readDate stores one instant as epoch milliseconds, and that you have created a formatter with Intl.DateTimeFormat. Here you will show that one instant as wall-clock time in any zone, not only the zone the runtime runs in.2 min readIntl.DateTimeFormat takes a locale and an options object, and that the timeZone option controls which zone an instant is displayed in. The toLocale* methods on Date use the same machinery with less typing.2 min readIntl.DateTimeFormat with a locale, component options, and the timeZone option. It covers two methods on the same formatter. formatToParts gives you the pieces of a formatted date. formatRange formats two dates as one span.2 min readDate objects to get milliseconds, and how to create a formatter with a locale tag and an options object, as covered earlier in the tutorial.2 min readresolvedOptions(). You should also be comfortable running JavaScript in a browser console or Node.js.2 min readresolvedOptions(). Those topics were covered in the Intl basics chapter. Dates often appear next to numbers, such as prices, durations, distances, and percentages. `Intl.NumberForma2 min readIntl.DateTimeFormat with a locale and options, as covered in the earlier chapters. You should also be comfortable running a script in Node.js or a browser console.2 min readDate, in particular those on local time versus UTC, date arithmetic, and daylight saving time (DST). You should also be comfortable running code in Node.js or a browser console.2 min read