@gobrand/tiempo 0.1.2 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -29,71 +29,153 @@ The Temporal API is already designed for timezone conversions, but it requires u
29
29
  ## Quick Start
30
30
 
31
31
  ```typescript
32
- import { utcToZonedTime, zonedTimeToUtc } from '@gobrand/tiempo';
32
+ import { toZonedTime, toUtcString } from '@gobrand/tiempo';
33
33
 
34
34
  // Backend sends: "2025-01-20T20:00:00.000Z"
35
- const zoned = utcToZonedTime("2025-01-20T20:00:00.000Z", "America/New_York");
35
+ const zoned = toZonedTime("2025-01-20T20:00:00.000Z", "America/New_York");
36
36
  console.log(zoned.hour); // 15 (3 PM in New York)
37
37
 
38
38
  // Send back to backend:
39
- const utc = zonedTimeToUtc(zoned);
39
+ const utc = toUtcString(zoned);
40
40
  console.log(utc); // "2025-01-20T20:00:00Z"
41
41
  ```
42
42
 
43
43
  ## API
44
44
 
45
- ### `utcToZonedTime(isoString, timezone)`
45
+ ### `toZonedTime(input, timezone)`
46
46
 
47
- Convert a UTC ISO string to a ZonedDateTime in the given timezone.
47
+ Convert a UTC ISO string, Instant, or ZonedDateTime to a ZonedDateTime in the specified timezone.
48
48
 
49
49
  **Parameters:**
50
- - `isoString` (string): A UTC ISO 8601 string (e.g., `"2025-01-20T20:00:00.000Z"`)
50
+ - `input` (string | Temporal.Instant | Temporal.ZonedDateTime): A UTC ISO 8601 string, Temporal.Instant, or Temporal.ZonedDateTime
51
51
  - `timezone` (string): An IANA timezone identifier (e.g., `"America/New_York"`, `"Europe/London"`)
52
52
 
53
53
  **Returns:** `Temporal.ZonedDateTime` - The same instant in the specified timezone
54
54
 
55
55
  **Example:**
56
56
  ```typescript
57
- import { utcToZonedTime } from '@gobrand/tiempo';
58
-
59
- // Backend sends: "2025-01-20T20:00:00.000Z"
60
- const zoned = utcToZonedTime("2025-01-20T20:00:00.000Z", "America/New_York");
57
+ import { toZonedTime } from '@gobrand/tiempo';
61
58
 
59
+ // From ISO string
60
+ const zoned = toZonedTime("2025-01-20T20:00:00.000Z", "America/New_York");
62
61
  console.log(zoned.hour); // 15 (3 PM in New York)
63
62
  console.log(zoned.toString()); // "2025-01-20T15:00:00-05:00[America/New_York]"
63
+
64
+ // From Instant
65
+ const instant = Temporal.Instant.from("2025-01-20T20:00:00Z");
66
+ const zoned2 = toZonedTime(instant, "Asia/Tokyo");
67
+
68
+ // From ZonedDateTime (convert to different timezone)
69
+ const nyTime = Temporal.ZonedDateTime.from("2025-01-20T15:00:00-05:00[America/New_York]");
70
+ const tokyoTime = toZonedTime(nyTime, "Asia/Tokyo");
64
71
  ```
65
72
 
66
- ### `zonedTimeToUtc(zonedDateTime)`
73
+ ### `toUtc(input)`
67
74
 
68
- Convert a ZonedDateTime to a UTC ISO string.
75
+ Convert a UTC ISO string or ZonedDateTime to a Temporal.Instant (UTC).
69
76
 
70
77
  **Parameters:**
71
- - `zonedDateTime` (`Temporal.ZonedDateTime`): A Temporal.ZonedDateTime instance
78
+ - `input` (string | Temporal.ZonedDateTime): A UTC ISO 8601 string or Temporal.ZonedDateTime
72
79
 
73
- **Returns:** `string` - A UTC ISO 8601 string representation of the instant
80
+ **Returns:** `Temporal.Instant` - A Temporal.Instant representing the same moment in UTC
74
81
 
75
82
  **Example:**
76
83
  ```typescript
77
- import { zonedTimeToUtc, utcToZonedTime } from '@gobrand/tiempo';
84
+ import { toUtc } from '@gobrand/tiempo';
78
85
 
79
- const zoned = utcToZonedTime("2025-01-20T20:00:00.000Z", "America/New_York");
86
+ // From ISO string
87
+ const instant = toUtc("2025-01-20T20:00:00.000Z");
80
88
 
81
- // Send back to backend:
82
- const utc = zonedTimeToUtc(zoned);
83
- console.log(utc); // "2025-01-20T20:00:00Z"
89
+ // From ZonedDateTime
90
+ const zoned = Temporal.ZonedDateTime.from("2025-01-20T15:00:00-05:00[America/New_York]");
91
+ const instant2 = toUtc(zoned);
92
+ // Both represent the same UTC moment: 2025-01-20T20:00:00Z
93
+ ```
94
+
95
+ ### `toUtcString(input)`
96
+
97
+ Convert a Temporal.Instant or ZonedDateTime to a UTC ISO 8601 string.
98
+
99
+ **Parameters:**
100
+ - `input` (Temporal.Instant | Temporal.ZonedDateTime): A Temporal.Instant or Temporal.ZonedDateTime
101
+
102
+ **Returns:** `string` - A UTC ISO 8601 string representation
103
+
104
+ **Example:**
105
+ ```typescript
106
+ import { toUtcString } from '@gobrand/tiempo';
107
+
108
+ // From ZonedDateTime
109
+ const zoned = Temporal.ZonedDateTime.from("2025-01-20T15:00:00-05:00[America/New_York]");
110
+ const iso = toUtcString(zoned);
111
+ console.log(iso); // "2025-01-20T20:00:00Z"
112
+
113
+ // From Instant
114
+ const instant = Temporal.Instant.from("2025-01-20T20:00:00Z");
115
+ const iso2 = toUtcString(instant);
116
+ console.log(iso2); // "2025-01-20T20:00:00Z"
117
+ ```
118
+
119
+ ### `format(input, formatStr, options?)`
120
+
121
+ Format a Temporal.Instant or ZonedDateTime using date-fns-like format tokens.
122
+
123
+ **Parameters:**
124
+ - `input` (Temporal.Instant | Temporal.ZonedDateTime): A Temporal.Instant or Temporal.ZonedDateTime to format
125
+ - `formatStr` (string): Format string using date-fns tokens (e.g., "yyyy-MM-dd HH:mm:ss")
126
+ - `options` (FormatOptions, optional): Configuration for locale and timezone
127
+ - `locale` (string): BCP 47 language tag (default: "en-US")
128
+ - `timeZone` (string): IANA timezone identifier to convert to before formatting
129
+
130
+ **Returns:** `string` - Formatted date string
131
+
132
+ **Supported tokens:**
133
+ - **Year**: `yyyy` (2025), `yy` (25), `y` (2025)
134
+ - **Month**: `MMMM` (January), `MMM` (Jan), `MM` (01), `M` (1), `Mo` (1st)
135
+ - **Day**: `dd` (20), `d` (20), `do` (20th)
136
+ - **Weekday**: `EEEE` (Monday), `EEE` (Mon), `EEEEE` (M)
137
+ - **Hour**: `HH` (15, 24h), `H` (15), `hh` (03, 12h), `h` (3)
138
+ - **Minute**: `mm` (30), `m` (30)
139
+ - **Second**: `ss` (45), `s` (45)
140
+ - **AM/PM**: `a` (PM), `aa` (PM), `aaa` (pm), `aaaa` (p.m.), `aaaaa` (p)
141
+ - **Timezone**: `xxx` (-05:00), `xx` (-0500), `XXX` (Z or -05:00), `zzzz` (Eastern Standard Time)
142
+ - **Quarter**: `Q` (1), `QQQ` (Q1), `QQQQ` (1st quarter)
143
+ - **Milliseconds**: `SSS` (123)
144
+ - **Timestamp**: `T` (milliseconds), `t` (seconds)
145
+ - **Escape text**: Use single quotes `'...'`, double single quotes `''` for literal quote
146
+
147
+ **Example:**
148
+ ```typescript
149
+ import { format } from '@gobrand/tiempo';
150
+
151
+ const zoned = Temporal.ZonedDateTime.from("2025-01-20T15:30:45-05:00[America/New_York]");
152
+
153
+ format(zoned, "yyyy-MM-dd"); // "2025-01-20"
154
+ format(zoned, "MMMM d, yyyy"); // "January 20, 2025"
155
+ format(zoned, "h:mm a"); // "3:30 PM"
156
+ format(zoned, "EEEE, MMMM do, yyyy 'at' h:mm a"); // "Monday, January 20th, 2025 at 3:30 PM"
157
+
158
+ // With locale
159
+ format(zoned, "MMMM d, yyyy", { locale: "es-ES" }); // "enero 20, 2025"
160
+ format(zoned, "EEEE", { locale: "fr-FR" }); // "lundi"
161
+
162
+ // Format Instant with timezone conversion
163
+ const instant = Temporal.Instant.from("2025-01-20T20:30:45Z");
164
+ format(instant, "yyyy-MM-dd HH:mm", { timeZone: "America/New_York" }); // "2025-01-20 15:30"
165
+ format(instant, "yyyy-MM-dd HH:mm", { timeZone: "Asia/Tokyo" }); // "2025-01-21 05:30"
84
166
  ```
85
167
 
86
168
  ## Complete Workflow Example
87
169
 
88
170
  ```typescript
89
- import { utcToZonedTime, zonedTimeToUtc } from '@gobrand/tiempo';
171
+ import { toZonedTime, toUtcString } from '@gobrand/tiempo';
90
172
 
91
173
  // 1. Receive UTC datetime from backend
92
174
  const scheduledAtUTC = "2025-01-20T20:00:00.000Z";
93
175
 
94
176
  // 2. Convert to user's timezone for display/editing
95
177
  const userTimezone = "America/New_York";
96
- const zonedDateTime = utcToZonedTime(scheduledAtUTC, userTimezone);
178
+ const zonedDateTime = toZonedTime(scheduledAtUTC, userTimezone);
97
179
 
98
180
  console.log(`Scheduled for: ${zonedDateTime.hour}:00`); // "Scheduled for: 15:00"
99
181
 
@@ -101,7 +183,7 @@ console.log(`Scheduled for: ${zonedDateTime.hour}:00`); // "Scheduled for: 15:00
101
183
  const updatedZoned = zonedDateTime.with({ hour: 16 });
102
184
 
103
185
  // 4. Convert back to UTC for sending to backend
104
- const updatedUTC = zonedTimeToUtc(updatedZoned);
186
+ const updatedUTC = toUtcString(updatedZoned);
105
187
  console.log(updatedUTC); // "2025-01-20T21:00:00Z"
106
188
  ```
107
189
 
@@ -0,0 +1,329 @@
1
+ // src/format.ts
2
+ import { Temporal } from "@js-temporal/polyfill";
3
+ function format(input, formatStr, options = {}) {
4
+ const { locale = "en-US", timeZone } = options;
5
+ let zonedDateTime;
6
+ if (input instanceof Temporal.Instant) {
7
+ const tz = timeZone || "UTC";
8
+ zonedDateTime = input.toZonedDateTimeISO(tz);
9
+ } else {
10
+ zonedDateTime = timeZone ? input.toInstant().toZonedDateTimeISO(timeZone) : input;
11
+ }
12
+ let result = "";
13
+ let i = 0;
14
+ const len = formatStr.length;
15
+ while (i < len) {
16
+ const char = formatStr[i];
17
+ if (!char) break;
18
+ if (char === "'") {
19
+ if (i + 1 < len && formatStr[i + 1] === "'") {
20
+ result += "'";
21
+ i += 2;
22
+ continue;
23
+ }
24
+ i++;
25
+ while (i < len) {
26
+ if (formatStr[i] === "'") {
27
+ if (i + 1 < len && formatStr[i + 1] === "'") {
28
+ result += "'";
29
+ i += 2;
30
+ } else {
31
+ i++;
32
+ break;
33
+ }
34
+ } else {
35
+ result += formatStr[i];
36
+ i++;
37
+ }
38
+ }
39
+ continue;
40
+ }
41
+ const token = consumeToken(formatStr, i, char);
42
+ if (token !== null) {
43
+ result += formatToken(token, zonedDateTime, locale);
44
+ i += token.length;
45
+ } else {
46
+ result += char;
47
+ i++;
48
+ }
49
+ }
50
+ return result;
51
+ }
52
+ function consumeToken(formatStr, start, char) {
53
+ if (char === "M" && start + 1 < formatStr.length && formatStr[start + 1] === "o") {
54
+ return "Mo";
55
+ }
56
+ if (char === "d" && start + 1 < formatStr.length && formatStr[start + 1] === "o") {
57
+ return "do";
58
+ }
59
+ let end = start;
60
+ while (end < formatStr.length && formatStr[end] === char) {
61
+ end++;
62
+ }
63
+ const count = end - start;
64
+ const validTokens = [
65
+ "GGGGG",
66
+ "GGGG",
67
+ "GGG",
68
+ "GG",
69
+ "G",
70
+ "yyyy",
71
+ "yyy",
72
+ "yy",
73
+ "y",
74
+ "QQQQQ",
75
+ "QQQQ",
76
+ "QQQ",
77
+ "QQ",
78
+ "Q",
79
+ "MMMMM",
80
+ "MMMM",
81
+ "MMM",
82
+ "MM",
83
+ "M",
84
+ "dd",
85
+ "d",
86
+ "EEEEEE",
87
+ "EEEEE",
88
+ "EEEE",
89
+ "EEE",
90
+ "EE",
91
+ "E",
92
+ "aaaaa",
93
+ "aaaa",
94
+ "aaa",
95
+ "aa",
96
+ "a",
97
+ "HH",
98
+ "H",
99
+ "hh",
100
+ "h",
101
+ "mm",
102
+ "m",
103
+ "ss",
104
+ "s",
105
+ "SSS",
106
+ "SS",
107
+ "S",
108
+ "XXXXX",
109
+ "XXXX",
110
+ "XXX",
111
+ "XX",
112
+ "X",
113
+ "xxxxx",
114
+ "xxxx",
115
+ "xxx",
116
+ "xx",
117
+ "x",
118
+ "zzzz",
119
+ "zzz",
120
+ "zz",
121
+ "z",
122
+ "T",
123
+ "t"
124
+ ];
125
+ for (let len = Math.min(count, 6); len > 0; len--) {
126
+ const candidate = char.repeat(len);
127
+ if (validTokens.includes(candidate)) {
128
+ return candidate;
129
+ }
130
+ }
131
+ return null;
132
+ }
133
+ function formatToken(token, zonedDateTime, locale) {
134
+ switch (token) {
135
+ // Era
136
+ case "GGGGG":
137
+ return formatPart(zonedDateTime, "era", "narrow", locale);
138
+ case "GGGG":
139
+ return formatPart(zonedDateTime, "era", "long", locale);
140
+ case "GGG":
141
+ case "GG":
142
+ case "G":
143
+ return formatPart(zonedDateTime, "era", "short", locale);
144
+ // Year
145
+ case "yyyy":
146
+ return zonedDateTime.year.toString().padStart(4, "0");
147
+ case "yyy":
148
+ return zonedDateTime.year.toString().padStart(3, "0");
149
+ case "yy":
150
+ return (zonedDateTime.year % 100).toString().padStart(2, "0");
151
+ case "y":
152
+ return zonedDateTime.year.toString();
153
+ // Quarter
154
+ case "QQQQQ":
155
+ return Math.ceil(zonedDateTime.month / 3).toString();
156
+ case "QQQQ": {
157
+ const quarter = Math.ceil(zonedDateTime.month / 3);
158
+ return `${quarter}${getOrdinalSuffix(quarter)} quarter`;
159
+ }
160
+ case "QQQ":
161
+ return `Q${Math.ceil(zonedDateTime.month / 3)}`;
162
+ case "QQ":
163
+ return Math.ceil(zonedDateTime.month / 3).toString().padStart(2, "0");
164
+ case "Q":
165
+ return Math.ceil(zonedDateTime.month / 3).toString();
166
+ // Month
167
+ case "MMMMM":
168
+ return formatPart(zonedDateTime, "month", "narrow", locale);
169
+ case "MMMM":
170
+ return formatPart(zonedDateTime, "month", "long", locale);
171
+ case "MMM":
172
+ return formatPart(zonedDateTime, "month", "short", locale);
173
+ case "MM":
174
+ return zonedDateTime.month.toString().padStart(2, "0");
175
+ case "Mo":
176
+ return `${zonedDateTime.month}${getOrdinalSuffix(zonedDateTime.month)}`;
177
+ case "M":
178
+ return zonedDateTime.month.toString();
179
+ // Day of month
180
+ case "do":
181
+ return `${zonedDateTime.day}${getOrdinalSuffix(zonedDateTime.day)}`;
182
+ case "dd":
183
+ return zonedDateTime.day.toString().padStart(2, "0");
184
+ case "d":
185
+ return zonedDateTime.day.toString();
186
+ // Day of week
187
+ case "EEEEEE":
188
+ return formatPart(zonedDateTime, "weekday", "short", locale).slice(0, 2);
189
+ case "EEEEE":
190
+ return formatPart(zonedDateTime, "weekday", "narrow", locale);
191
+ case "EEEE":
192
+ return formatPart(zonedDateTime, "weekday", "long", locale);
193
+ case "EEE":
194
+ case "EE":
195
+ case "E":
196
+ return formatPart(zonedDateTime, "weekday", "short", locale);
197
+ // AM/PM
198
+ case "aaaaa": {
199
+ const period = formatPart(zonedDateTime, "dayPeriod", "narrow", locale).toLowerCase();
200
+ return period.charAt(0);
201
+ }
202
+ case "aaaa": {
203
+ const period = formatPart(zonedDateTime, "dayPeriod", "short", locale);
204
+ return period === "AM" ? "a.m." : "p.m.";
205
+ }
206
+ case "aaa":
207
+ return formatPart(zonedDateTime, "dayPeriod", "short", locale).toLowerCase();
208
+ case "aa":
209
+ case "a":
210
+ return formatPart(zonedDateTime, "dayPeriod", "short", locale);
211
+ // Hour [0-23]
212
+ case "HH":
213
+ return zonedDateTime.hour.toString().padStart(2, "0");
214
+ case "H":
215
+ return zonedDateTime.hour.toString();
216
+ // Hour [1-12]
217
+ case "hh": {
218
+ const hour12 = zonedDateTime.hour % 12 || 12;
219
+ return hour12.toString().padStart(2, "0");
220
+ }
221
+ case "h": {
222
+ const hour12 = zonedDateTime.hour % 12 || 12;
223
+ return hour12.toString();
224
+ }
225
+ // Minute
226
+ case "mm":
227
+ return zonedDateTime.minute.toString().padStart(2, "0");
228
+ case "m":
229
+ return zonedDateTime.minute.toString();
230
+ // Second
231
+ case "ss":
232
+ return zonedDateTime.second.toString().padStart(2, "0");
233
+ case "s":
234
+ return zonedDateTime.second.toString();
235
+ // Fractional seconds
236
+ case "SSS":
237
+ return zonedDateTime.millisecond.toString().padStart(3, "0");
238
+ case "SS":
239
+ return Math.floor(zonedDateTime.millisecond / 10).toString().padStart(2, "0");
240
+ case "S":
241
+ return Math.floor(zonedDateTime.millisecond / 100).toString();
242
+ // Timezone
243
+ case "XXXXX": {
244
+ const offset = getTimezoneOffset(zonedDateTime);
245
+ return offset === "+00:00" ? "Z" : offset;
246
+ }
247
+ case "XXXX": {
248
+ const offset = getTimezoneOffset(zonedDateTime).replace(":", "");
249
+ return offset === "+0000" ? "Z" : offset;
250
+ }
251
+ case "XXX": {
252
+ const offset = getTimezoneOffset(zonedDateTime);
253
+ return offset === "+00:00" ? "Z" : offset;
254
+ }
255
+ case "XX": {
256
+ const offset = getTimezoneOffset(zonedDateTime).replace(":", "");
257
+ return offset === "+0000" ? "Z" : offset;
258
+ }
259
+ case "X": {
260
+ const offset = getTimezoneOffset(zonedDateTime);
261
+ if (offset === "+00:00") return "Z";
262
+ const [hours] = offset.split(":");
263
+ return hours || "+00";
264
+ }
265
+ case "xxxxx":
266
+ return getTimezoneOffset(zonedDateTime);
267
+ case "xxxx":
268
+ return getTimezoneOffset(zonedDateTime).replace(":", "");
269
+ case "xxx":
270
+ return getTimezoneOffset(zonedDateTime);
271
+ case "xx":
272
+ return getTimezoneOffset(zonedDateTime).replace(":", "");
273
+ case "x": {
274
+ const offset = getTimezoneOffset(zonedDateTime);
275
+ const [hours] = offset.split(":");
276
+ return hours || "+00";
277
+ }
278
+ case "zzzz":
279
+ return formatPart(zonedDateTime, "timeZoneName", "long", locale);
280
+ case "zzz":
281
+ case "zz":
282
+ case "z":
283
+ return formatPart(zonedDateTime, "timeZoneName", "short", locale);
284
+ // Timestamps
285
+ case "T":
286
+ return zonedDateTime.epochMilliseconds.toString();
287
+ case "t":
288
+ return Math.floor(zonedDateTime.epochMilliseconds / 1e3).toString();
289
+ default:
290
+ return token;
291
+ }
292
+ }
293
+ function formatPart(zonedDateTime, part, style, locale) {
294
+ const options = {};
295
+ if (part === "dayPeriod") {
296
+ options.hour = "numeric";
297
+ options.hour12 = true;
298
+ } else {
299
+ options[part] = style;
300
+ }
301
+ const formatted = zonedDateTime.toLocaleString(locale, options);
302
+ if (part === "dayPeriod") {
303
+ const match = formatted.match(/\b(AM|PM|am|pm|a\.m\.|p\.m\.)\b/);
304
+ return match ? match[0] : formatted.split(" ").pop() || "";
305
+ }
306
+ return formatted;
307
+ }
308
+ function getOrdinalSuffix(num) {
309
+ const j = num % 10;
310
+ const k = num % 100;
311
+ if (j === 1 && k !== 11) return "st";
312
+ if (j === 2 && k !== 12) return "nd";
313
+ if (j === 3 && k !== 13) return "rd";
314
+ return "th";
315
+ }
316
+ function getTimezoneOffset(zonedDateTime) {
317
+ const offsetNs = zonedDateTime.offsetNanoseconds;
318
+ const offsetMinutes = offsetNs / (60 * 1e9);
319
+ const sign = offsetMinutes >= 0 ? "+" : "-";
320
+ const absMinutes = Math.abs(offsetMinutes);
321
+ const hours = Math.floor(absMinutes / 60);
322
+ const minutes = absMinutes % 60;
323
+ return `${sign}${hours.toString().padStart(2, "0")}:${minutes.toString().padStart(2, "0")}`;
324
+ }
325
+
326
+ export {
327
+ format
328
+ };
329
+ //# sourceMappingURL=chunk-5FRUAUH2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/format.ts"],"sourcesContent":["import { Temporal } from '@js-temporal/polyfill';\n\nexport interface FormatOptions {\n locale?: string;\n timeZone?: string;\n}\n\n/**\n * Format a Temporal.Instant or ZonedDateTime using date-fns-like format tokens.\n * Uses Intl.DateTimeFormat under the hood via Temporal's toLocaleString() for zero dependencies.\n *\n * @param input - A Temporal.Instant or Temporal.ZonedDateTime to format\n * @param formatStr - Format string using date-fns tokens (e.g., \"yyyy-MM-dd HH:mm:ss\")\n * @param options - Optional configuration for locale and timezone\n * @returns Formatted date string\n *\n * @example\n * ```typescript\n * const zoned = Temporal.ZonedDateTime.from(\"2025-01-20T15:00:00-05:00[America/New_York]\");\n *\n * format(zoned, \"yyyy-MM-dd\"); // \"2025-01-20\"\n * format(zoned, \"MMMM d, yyyy\"); // \"January 20, 2025\"\n * format(zoned, \"h:mm a\"); // \"3:00 PM\"\n * format(zoned, \"EEEE, MMMM do, yyyy 'at' h:mm a\"); // \"Monday, January 20th, 2025 at 3:00 PM\"\n *\n * // With locale\n * format(zoned, \"MMMM d, yyyy\", { locale: \"es-ES\" }); // \"enero 20, 2025\"\n * ```\n */\nexport function format(\n input: Temporal.Instant | Temporal.ZonedDateTime,\n formatStr: string,\n options: FormatOptions = {}\n): string {\n const { locale = 'en-US', timeZone } = options;\n\n // Convert Instant to ZonedDateTime if needed\n let zonedDateTime: Temporal.ZonedDateTime;\n if (input instanceof Temporal.Instant) {\n const tz = timeZone || 'UTC';\n zonedDateTime = input.toZonedDateTimeISO(tz);\n } else {\n zonedDateTime = timeZone\n ? input.toInstant().toZonedDateTimeISO(timeZone)\n : input;\n }\n\n let result = '';\n let i = 0;\n const len = formatStr.length;\n\n while (i < len) {\n const char = formatStr[i];\n if (!char) break;\n\n // Handle escaped text\n if (char === \"'\") {\n // Check for double single quote (not inside a string, just '')\n if (i + 1 < len && formatStr[i + 1] === \"'\") {\n result += \"'\";\n i += 2;\n continue;\n }\n // Find closing quote, handling '' inside the string\n i++;\n while (i < len) {\n if (formatStr[i] === \"'\") {\n // Check if it's a doubled quote ''\n if (i + 1 < len && formatStr[i + 1] === \"'\") {\n result += \"'\";\n i += 2;\n } else {\n // End of quoted string\n i++;\n break;\n }\n } else {\n result += formatStr[i];\n i++;\n }\n }\n continue;\n }\n\n // Check for tokens by looking ahead\n const token = consumeToken(formatStr, i, char);\n if (token !== null) {\n result += formatToken(token, zonedDateTime, locale);\n i += token.length;\n } else {\n result += char;\n i++;\n }\n }\n\n return result;\n}\n\nfunction consumeToken(formatStr: string, start: number, char: string): string | null {\n // Special case for 'Mo' and 'do' - these end with 'o'\n if (char === 'M' && start + 1 < formatStr.length && formatStr[start + 1] === 'o') {\n return 'Mo';\n }\n if (char === 'd' && start + 1 < formatStr.length && formatStr[start + 1] === 'o') {\n return 'do';\n }\n\n // Count how many consecutive identical characters\n let end = start;\n while (end < formatStr.length && formatStr[end] === char) {\n end++;\n }\n const count = end - start;\n\n // Check if this is a valid token pattern\n const validTokens = [\n 'GGGGG',\n 'GGGG',\n 'GGG',\n 'GG',\n 'G',\n 'yyyy',\n 'yyy',\n 'yy',\n 'y',\n 'QQQQQ',\n 'QQQQ',\n 'QQQ',\n 'QQ',\n 'Q',\n 'MMMMM',\n 'MMMM',\n 'MMM',\n 'MM',\n 'M',\n 'dd',\n 'd',\n 'EEEEEE',\n 'EEEEE',\n 'EEEE',\n 'EEE',\n 'EE',\n 'E',\n 'aaaaa',\n 'aaaa',\n 'aaa',\n 'aa',\n 'a',\n 'HH',\n 'H',\n 'hh',\n 'h',\n 'mm',\n 'm',\n 'ss',\n 's',\n 'SSS',\n 'SS',\n 'S',\n 'XXXXX',\n 'XXXX',\n 'XXX',\n 'XX',\n 'X',\n 'xxxxx',\n 'xxxx',\n 'xxx',\n 'xx',\n 'x',\n 'zzzz',\n 'zzz',\n 'zz',\n 'z',\n 'T',\n 't',\n ];\n\n // Try to match from longest to shortest\n for (let len = Math.min(count, 6); len > 0; len--) {\n const candidate = char.repeat(len);\n if (validTokens.includes(candidate)) {\n return candidate;\n }\n }\n\n return null;\n}\n\nfunction formatToken(token: string, zonedDateTime: Temporal.ZonedDateTime, locale: string): string {\n switch (token) {\n // Era\n case 'GGGGG':\n return formatPart(zonedDateTime, 'era', 'narrow', locale);\n case 'GGGG':\n return formatPart(zonedDateTime, 'era', 'long', locale);\n case 'GGG':\n case 'GG':\n case 'G':\n return formatPart(zonedDateTime, 'era', 'short', locale);\n\n // Year\n case 'yyyy':\n return zonedDateTime.year.toString().padStart(4, '0');\n case 'yyy':\n return zonedDateTime.year.toString().padStart(3, '0');\n case 'yy':\n return (zonedDateTime.year % 100).toString().padStart(2, '0');\n case 'y':\n return zonedDateTime.year.toString();\n\n // Quarter\n case 'QQQQQ':\n return Math.ceil(zonedDateTime.month / 3).toString();\n case 'QQQQ': {\n const quarter = Math.ceil(zonedDateTime.month / 3);\n return `${quarter}${getOrdinalSuffix(quarter)} quarter`;\n }\n case 'QQQ':\n return `Q${Math.ceil(zonedDateTime.month / 3)}`;\n case 'QQ':\n return Math.ceil(zonedDateTime.month / 3)\n .toString()\n .padStart(2, '0');\n case 'Q':\n return Math.ceil(zonedDateTime.month / 3).toString();\n\n // Month\n case 'MMMMM':\n return formatPart(zonedDateTime, 'month', 'narrow', locale);\n case 'MMMM':\n return formatPart(zonedDateTime, 'month', 'long', locale);\n case 'MMM':\n return formatPart(zonedDateTime, 'month', 'short', locale);\n case 'MM':\n return zonedDateTime.month.toString().padStart(2, '0');\n case 'Mo':\n return `${zonedDateTime.month}${getOrdinalSuffix(zonedDateTime.month)}`;\n case 'M':\n return zonedDateTime.month.toString();\n\n // Day of month\n case 'do':\n return `${zonedDateTime.day}${getOrdinalSuffix(zonedDateTime.day)}`;\n case 'dd':\n return zonedDateTime.day.toString().padStart(2, '0');\n case 'd':\n return zonedDateTime.day.toString();\n\n // Day of week\n case 'EEEEEE':\n return formatPart(zonedDateTime, 'weekday', 'short', locale).slice(0, 2);\n case 'EEEEE':\n return formatPart(zonedDateTime, 'weekday', 'narrow', locale);\n case 'EEEE':\n return formatPart(zonedDateTime, 'weekday', 'long', locale);\n case 'EEE':\n case 'EE':\n case 'E':\n return formatPart(zonedDateTime, 'weekday', 'short', locale);\n\n // AM/PM\n case 'aaaaa': {\n const period = formatPart(zonedDateTime, 'dayPeriod', 'narrow', locale).toLowerCase();\n return period.charAt(0);\n }\n case 'aaaa': {\n const period = formatPart(zonedDateTime, 'dayPeriod', 'short', locale);\n return period === 'AM' ? 'a.m.' : 'p.m.';\n }\n case 'aaa':\n return formatPart(zonedDateTime, 'dayPeriod', 'short', locale).toLowerCase();\n case 'aa':\n case 'a':\n return formatPart(zonedDateTime, 'dayPeriod', 'short', locale);\n\n // Hour [0-23]\n case 'HH':\n return zonedDateTime.hour.toString().padStart(2, '0');\n case 'H':\n return zonedDateTime.hour.toString();\n\n // Hour [1-12]\n case 'hh': {\n const hour12 = zonedDateTime.hour % 12 || 12;\n return hour12.toString().padStart(2, '0');\n }\n case 'h': {\n const hour12 = zonedDateTime.hour % 12 || 12;\n return hour12.toString();\n }\n\n // Minute\n case 'mm':\n return zonedDateTime.minute.toString().padStart(2, '0');\n case 'm':\n return zonedDateTime.minute.toString();\n\n // Second\n case 'ss':\n return zonedDateTime.second.toString().padStart(2, '0');\n case 's':\n return zonedDateTime.second.toString();\n\n // Fractional seconds\n case 'SSS':\n return zonedDateTime.millisecond.toString().padStart(3, '0');\n case 'SS':\n return Math.floor(zonedDateTime.millisecond / 10)\n .toString()\n .padStart(2, '0');\n case 'S':\n return Math.floor(zonedDateTime.millisecond / 100).toString();\n\n // Timezone\n case 'XXXXX': {\n const offset = getTimezoneOffset(zonedDateTime);\n return offset === '+00:00' ? 'Z' : offset;\n }\n case 'XXXX': {\n const offset = getTimezoneOffset(zonedDateTime).replace(':', '');\n return offset === '+0000' ? 'Z' : offset;\n }\n case 'XXX': {\n const offset = getTimezoneOffset(zonedDateTime);\n return offset === '+00:00' ? 'Z' : offset;\n }\n case 'XX': {\n const offset = getTimezoneOffset(zonedDateTime).replace(':', '');\n return offset === '+0000' ? 'Z' : offset;\n }\n case 'X': {\n const offset = getTimezoneOffset(zonedDateTime);\n if (offset === '+00:00') return 'Z';\n const [hours] = offset.split(':');\n return hours || '+00';\n }\n case 'xxxxx':\n return getTimezoneOffset(zonedDateTime);\n case 'xxxx':\n return getTimezoneOffset(zonedDateTime).replace(':', '');\n case 'xxx':\n return getTimezoneOffset(zonedDateTime);\n case 'xx':\n return getTimezoneOffset(zonedDateTime).replace(':', '');\n case 'x': {\n const offset = getTimezoneOffset(zonedDateTime);\n const [hours] = offset.split(':');\n return hours || '+00';\n }\n case 'zzzz':\n return formatPart(zonedDateTime, 'timeZoneName', 'long', locale);\n case 'zzz':\n case 'zz':\n case 'z':\n return formatPart(zonedDateTime, 'timeZoneName', 'short', locale);\n\n // Timestamps\n case 'T':\n return zonedDateTime.epochMilliseconds.toString();\n case 't':\n return Math.floor(zonedDateTime.epochMilliseconds / 1000).toString();\n\n default:\n return token;\n }\n}\n\nfunction formatPart(\n zonedDateTime: Temporal.ZonedDateTime,\n part: 'era' | 'year' | 'month' | 'weekday' | 'day' | 'dayPeriod' | 'hour' | 'minute' | 'second' | 'timeZoneName',\n style: 'narrow' | 'short' | 'long' | 'numeric' | '2-digit',\n locale: string\n): string {\n const options: Intl.DateTimeFormatOptions = {};\n\n if (part === 'dayPeriod') {\n // dayPeriod needs hour to be present\n options.hour = 'numeric';\n options.hour12 = true;\n } else {\n options[part] = style as any;\n }\n\n const formatted = zonedDateTime.toLocaleString(locale, options);\n\n if (part === 'dayPeriod') {\n // Extract just the AM/PM part\n const match = formatted.match(/\\b(AM|PM|am|pm|a\\.m\\.|p\\.m\\.)\\b/);\n return match ? match[0] : formatted.split(' ').pop() || '';\n }\n\n return formatted;\n}\n\nfunction getOrdinalSuffix(num: number): string {\n const j = num % 10;\n const k = num % 100;\n if (j === 1 && k !== 11) return 'st';\n if (j === 2 && k !== 12) return 'nd';\n if (j === 3 && k !== 13) return 'rd';\n return 'th';\n}\n\nfunction getTimezoneOffset(zonedDateTime: Temporal.ZonedDateTime): string {\n const offsetNs = zonedDateTime.offsetNanoseconds;\n const offsetMinutes = offsetNs / (60 * 1e9);\n const sign = offsetMinutes >= 0 ? '+' : '-';\n const absMinutes = Math.abs(offsetMinutes);\n const hours = Math.floor(absMinutes / 60);\n const minutes = absMinutes % 60;\n return `${sign}${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}`;\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AA6BlB,SAAS,OACd,OACA,WACA,UAAyB,CAAC,GAClB;AACR,QAAM,EAAE,SAAS,SAAS,SAAS,IAAI;AAGvC,MAAI;AACJ,MAAI,iBAAiB,SAAS,SAAS;AACrC,UAAM,KAAK,YAAY;AACvB,oBAAgB,MAAM,mBAAmB,EAAE;AAAA,EAC7C,OAAO;AACL,oBAAgB,WACZ,MAAM,UAAU,EAAE,mBAAmB,QAAQ,IAC7C;AAAA,EACN;AAEA,MAAI,SAAS;AACb,MAAI,IAAI;AACR,QAAM,MAAM,UAAU;AAEtB,SAAO,IAAI,KAAK;AACd,UAAM,OAAO,UAAU,CAAC;AACxB,QAAI,CAAC,KAAM;AAGX,QAAI,SA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AM,cAAc,oBAAoB,GAAI,EAAE,SAAS;AAAA,IAErE;AACE,aAAO;AAAA,EACX;AACF;AAEA,SAAS,WACP,eACA,MACA,OACA,QACQ;AACR,QAAM,UAAsC,CAAC;AAE7C,MAAI,SAAS,aAAa;AAExB,YAAQ,OAAO;AACf,YAAQ,SAAS;AAAA,EACnB,OAAO;AACL,YAAQ,IAAI,IAAI;AAAA,EAClB;AAEA,QAAM,YAAY,cAAc,eAAe,QAAQ,OAAO;AAE9D,MAAI,SAAS,aAAa;AAExB,UAAM,QAAQ,UAAU,MAAM,iCAAiC;AAC/D,WAAO,QAAQ,MAAM,CAAC,IAAI,UAAU,MAAM,GAAG,EAAE,IAAI,KAAK;AAAA,EAC1D;AAEA,SAAO;AACT;AAEA,SAAS,iBAAiB,KAAqB;AAC7C,QAAM,IAAI,MAAM;AAChB,QAAM,IAAI,MAAM;AAChB,MAAI,MAAM,KAAK,MAAM,GAAI,QAAO;AAChC,MAAI,MAAM,KAAK,MAAM,GAAI,QAAO;AAChC,MAAI,MAAM,KAAK,MAAM,GAAI,QAAO;AAChC,SAAO;AACT;AAEA,SAAS,kBAAkB,eAA+C;AACxE,QAAM,WAAW,cAAc;AAC/B,QAAM,gBAAgB,YAAY,KAAK;AACvC,QAAM,OAAO,iBAAiB,IAAI,MAAM;AACxC,QAAM,aAAa,KAAK,IAAI,aAAa;AACzC,QAAM,QAAQ,KAAK,MAAM,aAAa,EAAE;AACxC,QAAM,UAAU,aAAa;AAC7B,SAAO,GAAG,IAAI,GAAG,MAAM,SAAS,EAAE,SAAS,GAAG,GAAG,CAAC,IAAI,QAAQ,SAAS,EAAE,SAAS,GAAG,GAAG,CAAC;AAC3F;","names":[]}
@@ -0,0 +1,13 @@
1
+ // src/toUtcString.ts
2
+ import { Temporal } from "@js-temporal/polyfill";
3
+ function toUtcString(input) {
4
+ if (input instanceof Temporal.Instant) {
5
+ return input.toString();
6
+ }
7
+ return input.toInstant().toString();
8
+ }
9
+
10
+ export {
11
+ toUtcString
12
+ };
13
+ //# sourceMappingURL=chunk-DMKGJY4N.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/toUtcString.ts"],"sourcesContent":["import { Temporal } from '@js-temporal/polyfill';\n\n/**\n * Convert a Temporal.Instant or ZonedDateTime to a UTC ISO 8601 string.\n *\n * @param input - A Temporal.Instant or Temporal.ZonedDateTime\n * @returns A UTC ISO 8601 string representation\n *\n * @example\n * ```typescript\n * // From ZonedDateTime\n * const zoned = Temporal.ZonedDateTime.from(\"2025-01-20T15:00:00-05:00[America/New_York]\");\n * const utcString = toUtcString(zoned);\n * // utcString === \"2025-01-20T20:00:00Z\"\n *\n * // From Instant\n * const instant = Temporal.Instant.from(\"2025-01-20T20:00:00Z\");\n * const utcString2 = toUtcString(instant);\n * // utcString2 === \"2025-01-20T20:00:00Z\"\n * ```\n */\nexport function toUtcString(\n input: Temporal.Instant | Temporal.ZonedDateTime\n): string {\n if (input instanceof Temporal.Instant) {\n return input.toString();\n }\n\n return input.toInstant().toString();\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AAqBlB,SAAS,YACd,OACQ;AACR,MAAI,iBAAiB,SAAS,SAAS;AACrC,WAAO,MAAM,SAAS;AAAA,EACxB;AAEA,SAAO,MAAM,UAAU,EAAE,SAAS;AACpC;","names":[]}
@@ -0,0 +1,13 @@
1
+ // src/toUtc.ts
2
+ import { Temporal } from "@js-temporal/polyfill";
3
+ function toUtc(input) {
4
+ if (typeof input === "string") {
5
+ return Temporal.Instant.from(input);
6
+ }
7
+ return input.toInstant();
8
+ }
9
+
10
+ export {
11
+ toUtc
12
+ };
13
+ //# sourceMappingURL=chunk-GPAFAHKJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/toUtc.ts"],"sourcesContent":["import { Temporal } from '@js-temporal/polyfill';\n\n/**\n * Convert a UTC ISO string or ZonedDateTime to a Temporal.Instant (UTC).\n *\n * @param input - A UTC ISO 8601 string or Temporal.ZonedDateTime\n * @returns A Temporal.Instant representing the same moment in UTC\n *\n * @example\n * ```typescript\n * // From ISO string\n * const instant = toUtc(\"2025-01-20T20:00:00.000Z\");\n *\n * // From ZonedDateTime\n * const zoned = Temporal.ZonedDateTime.from(\"2025-01-20T15:00:00-05:00[America/New_York]\");\n * const instant2 = toUtc(zoned);\n * // Both represent the same UTC moment: 2025-01-20T20:00:00Z\n * ```\n */\nexport function toUtc(\n input: string | Temporal.ZonedDateTime\n): Temporal.Instant {\n if (typeof input === 'string') {\n return Temporal.Instant.from(input);\n }\n\n return input.toInstant();\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AAmBlB,SAAS,MACd,OACkB;AAClB,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO,SAAS,QAAQ,KAAK,KAAK;AAAA,EACpC;AAEA,SAAO,MAAM,UAAU;AACzB;","names":[]}
@@ -0,0 +1,16 @@
1
+ // src/toZonedTime.ts
2
+ import { Temporal } from "@js-temporal/polyfill";
3
+ function toZonedTime(input, timezone) {
4
+ if (typeof input === "string") {
5
+ return Temporal.Instant.from(input).toZonedDateTimeISO(timezone);
6
+ }
7
+ if (input instanceof Temporal.Instant) {
8
+ return input.toZonedDateTimeISO(timezone);
9
+ }
10
+ return input.toInstant().toZonedDateTimeISO(timezone);
11
+ }
12
+
13
+ export {
14
+ toZonedTime
15
+ };
16
+ //# sourceMappingURL=chunk-KD5GEHUA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/toZonedTime.ts"],"sourcesContent":["import { Temporal } from '@js-temporal/polyfill';\n\n/**\n * Convert a UTC ISO string, Instant, or ZonedDateTime to a ZonedDateTime in the specified timezone.\n *\n * @param input - A UTC ISO 8601 string, Temporal.Instant, or Temporal.ZonedDateTime\n * @param timezone - IANA timezone identifier (e.g., \"America/New_York\", \"Europe/London\")\n * @returns A Temporal.ZonedDateTime in the specified timezone\n *\n * @example\n * ```typescript\n * // From ISO string\n * const zoned = toZonedTime(\"2025-01-20T20:00:00.000Z\", \"America/New_York\");\n * // zoned.hour === 15 (3 PM in New York)\n *\n * // From Instant\n * const instant = Temporal.Instant.from(\"2025-01-20T20:00:00Z\");\n * const zoned2 = toZonedTime(instant, \"Asia/Tokyo\");\n *\n * // From ZonedDateTime (convert to different timezone)\n * const nyTime = Temporal.ZonedDateTime.from(\"2025-01-20T15:00:00-05:00[America/New_York]\");\n * const tokyoTime = toZonedTime(nyTime, \"Asia/Tokyo\");\n * ```\n */\nexport function toZonedTime(\n input: string | Temporal.Instant | Temporal.ZonedDateTime,\n timezone: string\n): Temporal.ZonedDateTime {\n if (typeof input === 'string') {\n return Temporal.Instant.from(input).toZonedDateTimeISO(timezone);\n }\n\n if (input instanceof Temporal.Instant) {\n return input.toZonedDateTimeISO(timezone);\n }\n\n return input.toInstant().toZonedDateTimeISO(timezone);\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AAwBlB,SAAS,YACd,OACA,UACwB;AACxB,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO,SAAS,QAAQ,KAAK,KAAK,EAAE,mBAAmB,QAAQ;AAAA,EACjE;AAEA,MAAI,iBAAiB,SAAS,SAAS;AACrC,WAAO,MAAM,mBAAmB,QAAQ;AAAA,EAC1C;AAEA,SAAO,MAAM,UAAU,EAAE,mBAAmB,QAAQ;AACtD;","names":[]}
@@ -0,0 +1,29 @@
1
+ import { Temporal } from '@js-temporal/polyfill';
2
+ export interface FormatOptions {
3
+ locale?: string;
4
+ timeZone?: string;
5
+ }
6
+ /**
7
+ * Format a Temporal.Instant or ZonedDateTime using date-fns-like format tokens.
8
+ * Uses Intl.DateTimeFormat under the hood via Temporal's toLocaleString() for zero dependencies.
9
+ *
10
+ * @param input - A Temporal.Instant or Temporal.ZonedDateTime to format
11
+ * @param formatStr - Format string using date-fns tokens (e.g., "yyyy-MM-dd HH:mm:ss")
12
+ * @param options - Optional configuration for locale and timezone
13
+ * @returns Formatted date string
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * const zoned = Temporal.ZonedDateTime.from("2025-01-20T15:00:00-05:00[America/New_York]");
18
+ *
19
+ * format(zoned, "yyyy-MM-dd"); // "2025-01-20"
20
+ * format(zoned, "MMMM d, yyyy"); // "January 20, 2025"
21
+ * format(zoned, "h:mm a"); // "3:00 PM"
22
+ * format(zoned, "EEEE, MMMM do, yyyy 'at' h:mm a"); // "Monday, January 20th, 2025 at 3:00 PM"
23
+ *
24
+ * // With locale
25
+ * format(zoned, "MMMM d, yyyy", { locale: "es-ES" }); // "enero 20, 2025"
26
+ * ```
27
+ */
28
+ export declare function format(input: Temporal.Instant | Temporal.ZonedDateTime, formatStr: string, options?: FormatOptions): string;
29
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,MAAM,CACpB,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EAChD,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,aAAkB,GAC1B,MAAM,CA+DR"}
package/dist/format.js ADDED
@@ -0,0 +1,7 @@
1
+ import {
2
+ format
3
+ } from "./chunk-5FRUAUH2.js";
4
+ export {
5
+ format
6
+ };
7
+ //# sourceMappingURL=format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=format.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.test.d.ts","sourceRoot":"","sources":["../src/format.test.ts"],"names":[],"mappings":""}
package/dist/index.d.ts CHANGED
@@ -1,32 +1,5 @@
1
- import { Temporal } from '@js-temporal/polyfill';
2
- /**
3
- * Convert a UTC ISO string to a ZonedDateTime in the given timezone.
4
- *
5
- * @param isoString - A UTC ISO 8601 string (e.g., "2025-01-20T20:00:00.000Z")
6
- * @param timezone - An IANA timezone identifier (e.g., "America/New_York", "Europe/London")
7
- * @returns A Temporal.ZonedDateTime representing the same instant in the specified timezone
8
- *
9
- * @example
10
- * ```typescript
11
- * // Backend sends: "2025-01-20T20:00:00.000Z"
12
- * const zoned = utcToZonedTime("2025-01-20T20:00:00.000Z", "America/New_York");
13
- * // zoned.hour === 15 (3 PM in New York)
14
- * // zoned.toString() === "2025-01-20T15:00:00-05:00[America/New_York]"
15
- * ```
16
- */
17
- export declare function utcToZonedTime(isoString: string, timezone: string): Temporal.ZonedDateTime;
18
- /**
19
- * Convert a ZonedDateTime to a UTC ISO string.
20
- *
21
- * @param zonedDateTime - A Temporal.ZonedDateTime instance
22
- * @returns A UTC ISO 8601 string representation of the instant
23
- *
24
- * @example
25
- * ```typescript
26
- * const zoned = Temporal.ZonedDateTime.from("2025-01-20T15:00:00-05:00[America/New_York]");
27
- * const utc = zonedTimeToUtc(zoned);
28
- * // utc === "2025-01-20T20:00:00Z"
29
- * ```
30
- */
31
- export declare function zonedTimeToUtc(zonedDateTime: Temporal.ZonedDateTime): string;
1
+ export { toZonedTime } from './toZonedTime';
2
+ export { toUtc } from './toUtc';
3
+ export { toUtcString } from './toUtcString';
4
+ export { format, type FormatOptions } from './format';
32
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,GACf,QAAQ,CAAC,aAAa,CAExB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,aAAa,EAAE,QAAQ,CAAC,aAAa,GAAG,MAAM,CAE5E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC"}
package/dist/index.js CHANGED
@@ -1,13 +1,19 @@
1
- // src/index.ts
2
- import { Temporal } from "@js-temporal/polyfill";
3
- function utcToZonedTime(isoString, timezone) {
4
- return Temporal.Instant.from(isoString).toZonedDateTimeISO(timezone);
5
- }
6
- function zonedTimeToUtc(zonedDateTime) {
7
- return zonedDateTime.toInstant().toString();
8
- }
1
+ import {
2
+ format
3
+ } from "./chunk-5FRUAUH2.js";
4
+ import {
5
+ toUtc
6
+ } from "./chunk-GPAFAHKJ.js";
7
+ import {
8
+ toUtcString
9
+ } from "./chunk-DMKGJY4N.js";
10
+ import {
11
+ toZonedTime
12
+ } from "./chunk-KD5GEHUA.js";
9
13
  export {
10
- utcToZonedTime,
11
- zonedTimeToUtc
14
+ format,
15
+ toUtc,
16
+ toUtcString,
17
+ toZonedTime
12
18
  };
13
19
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { Temporal } from '@js-temporal/polyfill';\n\n/**\n * Convert a UTC ISO string to a ZonedDateTime in the given timezone.\n *\n * @param isoString - A UTC ISO 8601 string (e.g., \"2025-01-20T20:00:00.000Z\")\n * @param timezone - An IANA timezone identifier (e.g., \"America/New_York\", \"Europe/London\")\n * @returns A Temporal.ZonedDateTime representing the same instant in the specified timezone\n *\n * @example\n * ```typescript\n * // Backend sends: \"2025-01-20T20:00:00.000Z\"\n * const zoned = utcToZonedTime(\"2025-01-20T20:00:00.000Z\", \"America/New_York\");\n * // zoned.hour === 15 (3 PM in New York)\n * // zoned.toString() === \"2025-01-20T15:00:00-05:00[America/New_York]\"\n * ```\n */\nexport function utcToZonedTime(\n isoString: string,\n timezone: string\n): Temporal.ZonedDateTime {\n return Temporal.Instant.from(isoString).toZonedDateTimeISO(timezone);\n}\n\n/**\n * Convert a ZonedDateTime to a UTC ISO string.\n *\n * @param zonedDateTime - A Temporal.ZonedDateTime instance\n * @returns A UTC ISO 8601 string representation of the instant\n *\n * @example\n * ```typescript\n * const zoned = Temporal.ZonedDateTime.from(\"2025-01-20T15:00:00-05:00[America/New_York]\");\n * const utc = zonedTimeToUtc(zoned);\n * // utc === \"2025-01-20T20:00:00Z\"\n * ```\n */\nexport function zonedTimeToUtc(zonedDateTime: Temporal.ZonedDateTime): string {\n return zonedDateTime.toInstant().toString();\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AAiBlB,SAAS,eACd,WACA,UACwB;AACxB,SAAO,SAAS,QAAQ,KAAK,SAAS,EAAE,mBAAmB,QAAQ;AACrE;AAeO,SAAS,eAAe,eAA+C;AAC5E,SAAO,cAAc,UAAU,EAAE,SAAS;AAC5C;","names":[]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,20 @@
1
+ import { Temporal } from '@js-temporal/polyfill';
2
+ /**
3
+ * Convert a UTC ISO string or ZonedDateTime to a Temporal.Instant (UTC).
4
+ *
5
+ * @param input - A UTC ISO 8601 string or Temporal.ZonedDateTime
6
+ * @returns A Temporal.Instant representing the same moment in UTC
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * // From ISO string
11
+ * const instant = toUtc("2025-01-20T20:00:00.000Z");
12
+ *
13
+ * // From ZonedDateTime
14
+ * const zoned = Temporal.ZonedDateTime.from("2025-01-20T15:00:00-05:00[America/New_York]");
15
+ * const instant2 = toUtc(zoned);
16
+ * // Both represent the same UTC moment: 2025-01-20T20:00:00Z
17
+ * ```
18
+ */
19
+ export declare function toUtc(input: string | Temporal.ZonedDateTime): Temporal.Instant;
20
+ //# sourceMappingURL=toUtc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toUtc.d.ts","sourceRoot":"","sources":["../src/toUtc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,KAAK,CACnB,KAAK,EAAE,MAAM,GAAG,QAAQ,CAAC,aAAa,GACrC,QAAQ,CAAC,OAAO,CAMlB"}
package/dist/toUtc.js ADDED
@@ -0,0 +1,7 @@
1
+ import {
2
+ toUtc
3
+ } from "./chunk-GPAFAHKJ.js";
4
+ export {
5
+ toUtc
6
+ };
7
+ //# sourceMappingURL=toUtc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=toUtc.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toUtc.test.d.ts","sourceRoot":"","sources":["../src/toUtc.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,22 @@
1
+ import { Temporal } from '@js-temporal/polyfill';
2
+ /**
3
+ * Convert a Temporal.Instant or ZonedDateTime to a UTC ISO 8601 string.
4
+ *
5
+ * @param input - A Temporal.Instant or Temporal.ZonedDateTime
6
+ * @returns A UTC ISO 8601 string representation
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * // From ZonedDateTime
11
+ * const zoned = Temporal.ZonedDateTime.from("2025-01-20T15:00:00-05:00[America/New_York]");
12
+ * const utcString = toUtcString(zoned);
13
+ * // utcString === "2025-01-20T20:00:00Z"
14
+ *
15
+ * // From Instant
16
+ * const instant = Temporal.Instant.from("2025-01-20T20:00:00Z");
17
+ * const utcString2 = toUtcString(instant);
18
+ * // utcString2 === "2025-01-20T20:00:00Z"
19
+ * ```
20
+ */
21
+ export declare function toUtcString(input: Temporal.Instant | Temporal.ZonedDateTime): string;
22
+ //# sourceMappingURL=toUtcString.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toUtcString.d.ts","sourceRoot":"","sources":["../src/toUtcString.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GAC/C,MAAM,CAMR"}
@@ -0,0 +1,7 @@
1
+ import {
2
+ toUtcString
3
+ } from "./chunk-DMKGJY4N.js";
4
+ export {
5
+ toUtcString
6
+ };
7
+ //# sourceMappingURL=toUtcString.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=toUtcString.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toUtcString.test.d.ts","sourceRoot":"","sources":["../src/toUtcString.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,25 @@
1
+ import { Temporal } from '@js-temporal/polyfill';
2
+ /**
3
+ * Convert a UTC ISO string, Instant, or ZonedDateTime to a ZonedDateTime in the specified timezone.
4
+ *
5
+ * @param input - A UTC ISO 8601 string, Temporal.Instant, or Temporal.ZonedDateTime
6
+ * @param timezone - IANA timezone identifier (e.g., "America/New_York", "Europe/London")
7
+ * @returns A Temporal.ZonedDateTime in the specified timezone
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * // From ISO string
12
+ * const zoned = toZonedTime("2025-01-20T20:00:00.000Z", "America/New_York");
13
+ * // zoned.hour === 15 (3 PM in New York)
14
+ *
15
+ * // From Instant
16
+ * const instant = Temporal.Instant.from("2025-01-20T20:00:00Z");
17
+ * const zoned2 = toZonedTime(instant, "Asia/Tokyo");
18
+ *
19
+ * // From ZonedDateTime (convert to different timezone)
20
+ * const nyTime = Temporal.ZonedDateTime.from("2025-01-20T15:00:00-05:00[America/New_York]");
21
+ * const tokyoTime = toZonedTime(nyTime, "Asia/Tokyo");
22
+ * ```
23
+ */
24
+ export declare function toZonedTime(input: string | Temporal.Instant | Temporal.ZonedDateTime, timezone: string): Temporal.ZonedDateTime;
25
+ //# sourceMappingURL=toZonedTime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toZonedTime.d.ts","sourceRoot":"","sources":["../src/toZonedTime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,MAAM,GAAG,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EACzD,QAAQ,EAAE,MAAM,GACf,QAAQ,CAAC,aAAa,CAUxB"}
@@ -0,0 +1,7 @@
1
+ import {
2
+ toZonedTime
3
+ } from "./chunk-KD5GEHUA.js";
4
+ export {
5
+ toZonedTime
6
+ };
7
+ //# sourceMappingURL=toZonedTime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=toZonedTime.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toZonedTime.test.d.ts","sourceRoot":"","sources":["../src/toZonedTime.test.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gobrand/tiempo",
3
- "version": "0.1.2",
3
+ "version": "2.1.0",
4
4
  "description": "Lightweight utility functions for converting between UTC and timezone-aware datetimes using the Temporal API",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -33,7 +33,8 @@
33
33
  "build": "tsup && tsc --emitDeclarationOnly",
34
34
  "clean": "git clean -xdf .cache .turbo dist node_modules tsconfig.tsbuildinfo",
35
35
  "test": "vitest",
36
- "typecheck": "tsc --noEmit"
36
+ "typecheck": "tsc --noEmit",
37
+ "release": "bash scripts/release.sh"
37
38
  },
38
39
  "dependencies": {
39
40
  "@js-temporal/polyfill": "^0.5.1"