diff --git a/README.md b/README.md index a06f52d..52dd116 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,13 @@ in ~100 LoC. For Node.js & Browsers. XTZ is a poor man's `Temporal` polyfill, but just for time zones. \ Demo: +```js +// What's the current time, in ISO format? + +TZ.toLocalISOString(new Date()); // "2021-11-07T03:15:59.000-0500" +TZ.timeZone(); // "America/New_York" +``` + > What UTC time will it be when it's 3:15am in New York? ```js @@ -98,6 +105,7 @@ https://www.youtube.com/playlist?list=PLxki0D-ilnqa6horOJ2G18WMZlJeQFlAt # API +- `toLocalISOString(dateOrNull)` - `toTimeZone(utcDate, timeZone)` - `toTimeZoneISOString(isoString, timeZone)` - `toUTC(dtString, timeZone)` diff --git a/index.html b/index.html index 07ed944..4290794 100644 --- a/index.html +++ b/index.html @@ -86,6 +86,18 @@ String(((new Date()).getTimezoneOffset() % 60)).padStart(2, '0')
+
+

Local ISO+Offset String:

+
XTZ.toLocalISOString(new Date())
+ +
+
+ +
+

Relative TimeZone to Absolute UTC:

XTZ.toUTC("YYYY-03-14 03:15:69.000", "UTC")
@@ -182,6 +194,7 @@ Asia/Kolkata        +0530 (No DST) (30-min)
github.com/therootcompany/tz.js +