@gobrand/tiempo 2.3.4 → 2.3.5
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 +33 -25
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -18,31 +18,39 @@ yarn add @gobrand/tiempo
|
|
|
18
18
|
|
|
19
19
|
## Why tiempo?
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
**
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
|
|
21
|
+
JavaScript's `Date` object was modeled after a Java class that was deprecated over 25 years ago. It conflates timestamps with calendar dates, only works in UTC or device-local time, and its mutating methods cause countless bugs. The [Temporal API](https://tc39.es/proposal-temporal/docs/) is the modern replacement, designed from the ground up to fix these problems.
|
|
22
|
+
|
|
23
|
+
**tiempo** makes Temporal accessible with an intuitive, date-fns-style API:
|
|
24
|
+
|
|
25
|
+
### The Temporal Advantage
|
|
26
|
+
|
|
27
|
+
| Problem with `Date` | Temporal Solution | tiempo API |
|
|
28
|
+
|---------------------|-------------------|------------|
|
|
29
|
+
| Only UTC or local time | Any IANA timezone | `toZonedTime(date, "America/New_York")` |
|
|
30
|
+
| Millisecond precision | Nanosecond precision | `addNanoseconds()`, `differenceInNanoseconds()` |
|
|
31
|
+
| Mutating methods | Immutable operations | All functions return new values |
|
|
32
|
+
| Ambiguous representations | Distinct types for each use case | `Instant`, `ZonedDateTime`, `PlainDate` |
|
|
33
|
+
| DST bugs everywhere | DST-aware arithmetic | `addDays()` respects timezone rules |
|
|
34
|
+
| Gregorian calendar only | Multi-calendar support | Works with Hebrew, Chinese, Japanese, and more |
|
|
35
|
+
|
|
36
|
+
### Features
|
|
37
|
+
|
|
38
|
+
- **First-class timezone support** - Convert, compare, and calculate across any of 400+ IANA timezones with confidence
|
|
39
|
+
- **Nanosecond precision** - Beyond milliseconds for scientific computing, financial systems, and high-frequency operations
|
|
40
|
+
- **DST-safe arithmetic** - Adding days means calendar days, not 24-hour periods that break at clock changes
|
|
41
|
+
- **Immutable by design** - No mutations, no side effects, no surprises
|
|
42
|
+
- **Type-safe** - Full TypeScript support catches datetime errors at compile time
|
|
43
|
+
- **Familiar API** - date-fns-style functions built on modern foundations
|
|
44
|
+
- **Zero dependencies** - Only the Temporal polyfill for browser compatibility
|
|
45
|
+
|
|
46
|
+
### Perfect for
|
|
47
|
+
|
|
48
|
+
- **Scheduling apps** - Social media, meetings, reminders with proper timezone handling
|
|
49
|
+
- **Booking systems** - Hotels, flights, events across global timezones
|
|
50
|
+
- **Calendar applications** - Date math that respects DST and leap years
|
|
51
|
+
- **Time tracking** - Precise duration calculations with nanosecond accuracy
|
|
52
|
+
- **Analytics dashboards** - Aggregate by day/week/month in user timezones
|
|
53
|
+
- **Global applications** - Any app serving users across multiple timezones
|
|
46
54
|
|
|
47
55
|
## Quick Start
|
|
48
56
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gobrand/tiempo",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.5",
|
|
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": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"bugs": {
|
|
29
29
|
"url": "https://github.com/go-brand/tiempo/issues"
|
|
30
30
|
},
|
|
31
|
-
"homepage": "https://
|
|
31
|
+
"homepage": "https://eng.gobrand.app/tiempo",
|
|
32
32
|
"scripts": {
|
|
33
33
|
"build": "tsup && tsc --emitDeclarationOnly",
|
|
34
34
|
"clean": "git clean -xdf .cache .turbo dist node_modules tsconfig.tsbuildinfo",
|