@gobrand/tiempo 2.1.0 → 2.1.1

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.
Files changed (2) hide show
  1. package/README.md +6 -4
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -146,9 +146,11 @@ Format a Temporal.Instant or ZonedDateTime using date-fns-like format tokens.
146
146
 
147
147
  **Example:**
148
148
  ```typescript
149
- import { format } from '@gobrand/tiempo';
149
+ import { format, toZonedTime, toUtc } from '@gobrand/tiempo';
150
150
 
151
- const zoned = Temporal.ZonedDateTime.from("2025-01-20T15:30:45-05:00[America/New_York]");
151
+ // From ISO string to ZonedDateTime, then format
152
+ const isoString = "2025-01-20T20:30:45.000Z";
153
+ const zoned = toZonedTime(isoString, "America/New_York");
152
154
 
153
155
  format(zoned, "yyyy-MM-dd"); // "2025-01-20"
154
156
  format(zoned, "MMMM d, yyyy"); // "January 20, 2025"
@@ -159,8 +161,8 @@ format(zoned, "EEEE, MMMM do, yyyy 'at' h:mm a"); // "Monday, January 20th, 2025
159
161
  format(zoned, "MMMM d, yyyy", { locale: "es-ES" }); // "enero 20, 2025"
160
162
  format(zoned, "EEEE", { locale: "fr-FR" }); // "lundi"
161
163
 
162
- // Format Instant with timezone conversion
163
- const instant = Temporal.Instant.from("2025-01-20T20:30:45Z");
164
+ // From ISO string to Instant (UTC), then format with timezone conversion
165
+ const instant = toUtc(isoString);
164
166
  format(instant, "yyyy-MM-dd HH:mm", { timeZone: "America/New_York" }); // "2025-01-20 15:30"
165
167
  format(instant, "yyyy-MM-dd HH:mm", { timeZone: "Asia/Tokyo" }); // "2025-01-21 05:30"
166
168
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gobrand/tiempo",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
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": {