You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TAI initialization, improved i18n, improved sourcemaps, etc. (#16)
* Added option to initialize `DateTime` object with TAI.
* Made timezone names case insensitive.
* Added `DateTimeFormatOptions` options to Ixx format strings.
* Improved i18n support for AM/PM time formats.
* `newDateTimeFormat` function for creating DateTimeFormat instances with more flexible options.
* TAI treated as named timezone or displayed with formatted UTC offsets.
Copy file name to clipboardExpand all lines: README.md
+20-1Lines changed: 20 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -149,6 +149,7 @@ While there are a wide range of functions and classes available from **@tubular/
149
149
|`ttime('2017‑03‑02 14:45 Europe/Paris')`| From an ISO-8601 date/time (variant with space instead of `T`) and IANA timezone. |`DateTime<2017-03-02T14:45:00.000 +01:00>`|
150
150
|`ttime('20:17:15')`| Dateless time from an ISO-8601 time string. |`DateTime<20:17:15.000>`|
151
151
|`ttime(1200848400000)`| From a millisecond timestamp. |`DateTime<2008-01-20T12:00:00.000 -05:00>`|
152
+
|`ttime({ tai: 1200848400000 })`| From a TAI millisecond timestamp. |`DateTime<2008-01-20T12:00:00.000 -05:00>`|
152
153
|`ttime({ y: 2008, m: 1, d: 20, hrs: 12, min: 0 })`| From a `DateAndTime` object, short-style field names. |`DateTime<2008-01-20T12:00:00.000 -05:00>`|
153
154
|`ttime({ year: 2008, month: 1, day: 20, hour: 12, minute: 0 })`| From a `DateAndTime` object, long-style field names. |`DateTime<2008-01-20T12:00:00.000 -05:00>`|
154
155
|`ttime([2013, 12, 11, 10, 9, 8, 765])`| From a numeric array: year, month, day, (hour (0-23), minute, second, millisecond), in that order. |`DateTime<2013-12-11T10:09:08.765 -05:00>`|
@@ -247,7 +248,7 @@ Please note that, as most unaccented Latin letters are interpreted as special fo
247
248
|| SSSS... | Additional zeros after milliseconds. |
|| zzz | Australian Central Standard Time, Pacific Daylight Time, etc.<br><br>_Long form names are only for output — cannot be parsed._|
250
-
| | ZZ | -0700 -0600 ... +0600 +0700
251
+
| | ZZ | -0700 -0600 ... +0600 +0700<br><br>If used with a TAI time, the displayed offset will be the difference between TAI and UTC at a given moment in time. Outside of the well-defined span of officially-declared leap seconds, this offset might be displayed with millisecond precision.
251
252
|| zz, z | EST, CDT, MST, PDT, AEST, etc.<br><br>Please note that timezones in this format are not internationalized, and are not unambiguous when parsed. |
252
253
| | Z | -07:00 -06:00 ... +06:00 +07:00
253
254
| Unix timestamp, UTC | X | 1360013296 |
@@ -295,6 +296,12 @@ The capital letters `F`, `L`, `M`, and `S` correspond to the option values `'ful
295
296
| IS |`9/4/86`|
296
297
| IxL |`8:30:00 PM EDT`|
297
298
299
+
You can also augment these formats with brace-enclosed `Intl.DateTimeFormatOptions`, such as:
300
+
301
+
`IMM{hourCycle:23h}`
302
+
303
+
...which will start with whatever the localized time formatting is and force it into 24-hour time, whether the standard localized form is a 12- or 24-hour format. Note that no quotes are placed around the option values, as they would be in JavaScript/TypeScript code.
304
+
298
305
## Pre-defined formats
299
306
300
307
```javascript
@@ -1598,6 +1605,18 @@ For a given UT1 Julian Date (Universal Time), return the Julian Date in ephemeri
1598
1605
ttime.utToTdt(timeJDU: number): number;
1599
1606
```
1600
1607
1608
+
Create new `Intl.DateTimeFormat` instances with more flexibility for mixing options. For instance:
...an exception is thrown. By using `newDateTimeFormat`, however, `@tubular/time` will attempt to override `dateStyle` and `timeStyle` options with specific variations which are otherwise disallowed.
0 commit comments