@gobrand/tiempo 3.2.1 → 3.2.2

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 +33 -8
  2. package/package.json +18 -3
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  [![CI](https://github.com/go-brand/tiempo/actions/workflows/ci.yml/badge.svg)](https://github.com/go-brand/tiempo/actions/workflows/ci.yml)
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
6
 
7
- **Timezone conversions that don't suck.** Built on the [Temporal API](https://tc39.es/proposal-temporal/docs/).
7
+ **date-fns-style functions for the [Temporal API](https://tc39.es/proposal-temporal/docs/).** Convert timezones, do date math that survives daylight saving time, format, parse, and count business days, in TypeScript.
8
8
 
9
9
  👉 **[Documentation](https://tiempo.gobrand.app)**
10
10
 
@@ -20,16 +20,16 @@
20
20
  ```typescript
21
21
  import { toZonedTime, addDays, format, toIso } from '@gobrand/tiempo';
22
22
 
23
- // Backend sends UTC
24
- const utc = "2025-03-09T07:00:00Z";
23
+ // Backend sends UTC: Saturday 3:00 AM in New York
24
+ const utc = "2026-03-07T08:00:00Z";
25
25
 
26
- // Convert to user's timezone, manipulate, format
26
+ // Convert to the user's timezone and add a day across the DST change
27
27
  const userTime = toZonedTime(utc, "America/New_York");
28
- const tomorrow = addDays(userTime, 1); // DST transition handled correctly
29
- const display = format(tomorrow, "EEEE 'at' h:mm a"); // "Monday at 3:00 AM"
28
+ const tomorrow = addDays(userTime, 1);
29
+ format(tomorrow, "EEEE 'at' h:mm a"); // "Sunday at 3:00 AM"
30
30
 
31
- // Send back to backend as ISO 8601 string
32
- const payload = toIso(tomorrow); // "2025-03-10T07:00:00Z"
31
+ // Send back to the backend as an ISO 8601 string
32
+ toIso(tomorrow); // "2026-03-08T07:00:00Z" (23 hours later; clocks moved forward)
33
33
  ```
34
34
 
35
35
  ## Install
@@ -38,10 +38,35 @@ const payload = toIso(tomorrow); // "2025-03-10T07:00:00Z"
38
38
  npm install @gobrand/tiempo
39
39
  ```
40
40
 
41
+ Runs on Node.js 22+ and in modern browsers. tiempo depends on [`@js-temporal/polyfill`](https://github.com/js-temporal/temporal-polyfill), so it works whether or not your runtime has Temporal built in, and it accepts values from native `Temporal` (Node.js 26+) too.
42
+
43
+ ## Coming from date-fns
44
+
45
+ Most names and argument orders are the same. What changes is that every value says what it is:
46
+
47
+ | date-fns | tiempo |
48
+ |---|---|
49
+ | `addDays(new Date(), 1)` | `addDays(now('Europe/Madrid'), 1)` |
50
+ | `parseISO(str)` | `toZonedTime(str, timezone)` or `toPlainDate(str)` |
51
+ | `format(date, 'yyyy-MM-dd')` | `format(value, 'yyyy-MM-dd')` |
52
+ | `differenceInDays(later, earlier)` | `differenceInDays(later, earlier)` |
53
+ | `formatInTimeZone(date, tz, fmt)` (date-fns-tz) | `format(instant, fmt, { timeZone: tz })` |
54
+
55
+ The full mapping is at [tiempo.gobrand.app/docs/date-fns](https://tiempo.gobrand.app/docs/date-fns).
56
+
41
57
  ## Docs
42
58
 
43
59
  **[tiempo.gobrand.app](https://tiempo.gobrand.app)** — Full API reference, examples, and guides.
44
60
 
61
+ Guides:
62
+
63
+ - [Replace JavaScript Date with Temporal](https://tiempo.gobrand.app/docs/guides/replace-date-with-temporal)
64
+ - [Convert UTC to a user's timezone](https://tiempo.gobrand.app/docs/guides/convert-utc-to-timezone)
65
+ - [Add days across daylight saving time](https://tiempo.gobrand.app/docs/guides/dst-safe-date-math)
66
+ - [Start and end of day in a timezone](https://tiempo.gobrand.app/docs/guides/start-and-end-of-day)
67
+ - [Store dates in a database](https://tiempo.gobrand.app/docs/guides/store-dates-in-a-database)
68
+ - [Count business days with holidays](https://tiempo.gobrand.app/docs/guides/business-days-with-holidays)
69
+
45
70
  For coding agents: [llms.txt](https://tiempo.gobrand.app/llms.txt), or install the Agent Skill with `npx skills add go-brand/tiempo`.
46
71
 
47
72
  ## License
package/package.json CHANGED
@@ -1,13 +1,28 @@
1
1
  {
2
2
  "name": "@gobrand/tiempo",
3
- "version": "3.2.1",
3
+ "version": "3.2.2",
4
4
  "private": false,
5
- "description": "Lightweight timezone-safe date and time utilities built on the Temporal API",
5
+ "description": "date-fns-style functions for the Temporal API: timezone conversion, DST-safe date math, formatting, parsing, and business days, in TypeScript",
6
6
  "keywords": [
7
+ "business-days",
8
+ "date",
9
+ "date-fns",
7
10
  "datetime",
11
+ "dayjs",
12
+ "daylight-saving-time",
13
+ "dst",
14
+ "format",
15
+ "iana",
16
+ "moment",
17
+ "parse",
18
+ "plain-date",
8
19
  "temporal",
9
- "time-conversion",
20
+ "temporal-api",
21
+ "temporal-polyfill",
22
+ "time",
23
+ "time-zone",
10
24
  "timezone",
25
+ "typescript",
11
26
  "utc",
12
27
  "zoned-datetime"
13
28
  ],