@charlite/react-temporal 1.1.0 → 1.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.
- package/CHANGELOG.md +12 -0
- package/README.md +5 -5
- package/dist/types.d.ts +1 -1
- package/docs/README.md +1 -1
- package/docs/api-reference.md +3 -3
- package/docs/getting-started.md +6 -6
- package/docs/installation.md +5 -5
- package/docs/migration.md +6 -6
- package/docs/polyfill.md +4 -4
- package/docs/typescript.md +5 -5
- package/package.json +3 -4
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.1.1] - 2026-10-09
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- npm package name and documentation updated from `@xarlizard/react-temporal` to **`@charlite/react-temporal`**.
|
|
13
|
+
- CI package install smoke tests use the scoped name from `package.json`.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- `hasNativeTemporal` test no longer assumes native Temporal is absent (passes on Node.js 26+ with built-in Temporal).
|
|
18
|
+
|
|
8
19
|
## [1.1.0] - 2026-10-08
|
|
9
20
|
|
|
10
21
|
### Added
|
|
@@ -87,6 +98,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
87
98
|
- Documentation and usage instructions in `README.md`.
|
|
88
99
|
- Semantic versioning and changelog support.
|
|
89
100
|
|
|
101
|
+
[1.1.1]: https://github.com/charlite/react-temporal/compare/v1.1.0...v1.1.1
|
|
90
102
|
[1.1.0]: https://github.com/charlite/react-temporal/compare/v1.0.0...v1.1.0
|
|
91
103
|
[1.0.0]: https://github.com/charlite/react-temporal/compare/v0.0.3...v1.0.0
|
|
92
104
|
[0.0.3]: https://github.com/charlite/react-temporal/compare/v0.0.2...v0.0.3
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# react-temporal
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/@charlite/react-temporal)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
[](https://www.typescriptlang.org/)
|
|
6
6
|
[](https://github.com/charlite/react-temporal/actions/workflows/ci.yml)
|
|
@@ -31,7 +31,7 @@ Replace `Date`, Moment.js, and most `date-fns` use cases with immutable, time-zo
|
|
|
31
31
|
## Install
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
|
-
npm install react-temporal
|
|
34
|
+
npm install @charlite/react-temporal
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
### Polyfill (Safari, older browsers, Node < 26)
|
|
@@ -61,7 +61,7 @@ import 'temporal-polyfill/global';
|
|
|
61
61
|
All hooks are named exports. Import `Temporal` from the package or from your polyfill:
|
|
62
62
|
|
|
63
63
|
```tsx
|
|
64
|
-
import { useTemporalNow, useTemporalZonedNow, Temporal } from 'react-temporal';
|
|
64
|
+
import { useTemporalNow, useTemporalZonedNow, Temporal } from '@charlite/react-temporal';
|
|
65
65
|
|
|
66
66
|
function Clock() {
|
|
67
67
|
const now = useTemporalNow();
|
|
@@ -79,7 +79,7 @@ function Clock() {
|
|
|
79
79
|
### Configurable clock
|
|
80
80
|
|
|
81
81
|
```tsx
|
|
82
|
-
import { useTemporalNow, useTemporalClock } from 'react-temporal';
|
|
82
|
+
import { useTemporalNow, useTemporalClock } from '@charlite/react-temporal';
|
|
83
83
|
|
|
84
84
|
// Update every 100 ms for a smooth timer UI
|
|
85
85
|
const now = useTemporalClock({ intervalMs: 100 });
|
|
@@ -140,7 +140,7 @@ See [`examples/`](examples/README.md) for copy-paste examples, or the [`docs/`](
|
|
|
140
140
|
Full type exports are included. Types are sourced from `temporal-polyfill` and work with native Temporal at runtime:
|
|
141
141
|
|
|
142
142
|
```ts
|
|
143
|
-
import type { TemporalInstant, TemporalPlainDate, UseTemporalNowOptions } from 'react-temporal';
|
|
143
|
+
import type { TemporalInstant, TemporalPlainDate, UseTemporalNowOptions } from '@charlite/react-temporal';
|
|
144
144
|
```
|
|
145
145
|
|
|
146
146
|
---
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Temporal } from 'temporal-polyfill';
|
|
2
|
-
/** Temporal namespace types (for annotations). Value access via `import { Temporal } from 'react-temporal'`. */
|
|
2
|
+
/** Temporal namespace types (for annotations). Value access via `import { Temporal } from '@charlite/react-temporal'`. */
|
|
3
3
|
export type TemporalTypes = typeof Temporal;
|
|
4
4
|
export type TemporalInstant = Temporal.Instant;
|
|
5
5
|
export type TemporalPlainDate = Temporal.PlainDate;
|
package/docs/README.md
CHANGED
package/docs/api-reference.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# API reference
|
|
2
2
|
|
|
3
|
-
All exports from
|
|
3
|
+
All exports from `@charlite/react-temporal`.
|
|
4
4
|
|
|
5
5
|
## Utilities
|
|
6
6
|
|
|
@@ -9,7 +9,7 @@ All exports from `react-temporal`.
|
|
|
9
9
|
Re-exported Temporal namespace (native or polyfill).
|
|
10
10
|
|
|
11
11
|
```ts
|
|
12
|
-
import { Temporal } from 'react-temporal';
|
|
12
|
+
import { Temporal } from '@charlite/react-temporal';
|
|
13
13
|
|
|
14
14
|
const date = Temporal.PlainDate.from('2026-07-05');
|
|
15
15
|
const now = Temporal.Now.instant();
|
|
@@ -20,7 +20,7 @@ const now = Temporal.Now.instant();
|
|
|
20
20
|
Returns the resolved Temporal namespace. Prefer using `Temporal` directly.
|
|
21
21
|
|
|
22
22
|
```ts
|
|
23
|
-
import { getTemporal } from 'react-temporal';
|
|
23
|
+
import { getTemporal } from '@charlite/react-temporal';
|
|
24
24
|
|
|
25
25
|
const T = getTemporal();
|
|
26
26
|
```
|
package/docs/getting-started.md
CHANGED
|
@@ -11,7 +11,7 @@ This guide walks you through installing **react-temporal** and using it in a Rea
|
|
|
11
11
|
## 1. Install the package
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
npm install react-temporal
|
|
14
|
+
npm install @charlite/react-temporal
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
## 2. Add a polyfill (if needed)
|
|
@@ -40,7 +40,7 @@ See the [Polyfill guide](./polyfill.md) for details.
|
|
|
40
40
|
## 3. Use a hook
|
|
41
41
|
|
|
42
42
|
```tsx
|
|
43
|
-
import { useTemporalNow } from 'react-temporal';
|
|
43
|
+
import { useTemporalNow } from '@charlite/react-temporal';
|
|
44
44
|
|
|
45
45
|
export function Clock() {
|
|
46
46
|
const now = useTemporalNow();
|
|
@@ -53,7 +53,7 @@ export function Clock() {
|
|
|
53
53
|
You do not need a separate polyfill import for types or values — the package re-exports `Temporal`:
|
|
54
54
|
|
|
55
55
|
```tsx
|
|
56
|
-
import { Temporal, useTemporalMonth } from 'react-temporal';
|
|
56
|
+
import { Temporal, useTemporalMonth } from '@charlite/react-temporal';
|
|
57
57
|
|
|
58
58
|
export function JulyCalendar() {
|
|
59
59
|
const dates = useTemporalMonth(Temporal.PlainDate.from('2026-07-01'));
|
|
@@ -73,7 +73,7 @@ export function JulyCalendar() {
|
|
|
73
73
|
### Live clock with time zone
|
|
74
74
|
|
|
75
75
|
```tsx
|
|
76
|
-
import { useTemporalZonedNow } from 'react-temporal';
|
|
76
|
+
import { useTemporalZonedNow } from '@charlite/react-temporal';
|
|
77
77
|
|
|
78
78
|
export function LocalClock({ timeZone }: { timeZone: string }) {
|
|
79
79
|
const now = useTemporalZonedNow(timeZone, { intervalMs: 1000 });
|
|
@@ -84,7 +84,7 @@ export function LocalClock({ timeZone }: { timeZone: string }) {
|
|
|
84
84
|
### Countdown timer
|
|
85
85
|
|
|
86
86
|
```tsx
|
|
87
|
-
import { useTemporalCountdown, Temporal } from 'react-temporal';
|
|
87
|
+
import { useTemporalCountdown, Temporal } from '@charlite/react-temporal';
|
|
88
88
|
|
|
89
89
|
export function Countdown({ iso }: { iso: string }) {
|
|
90
90
|
const target = Temporal.Instant.from(iso);
|
|
@@ -96,7 +96,7 @@ export function Countdown({ iso }: { iso: string }) {
|
|
|
96
96
|
### Relative time label
|
|
97
97
|
|
|
98
98
|
```tsx
|
|
99
|
-
import { useTemporalRelative, Temporal } from 'react-temporal';
|
|
99
|
+
import { useTemporalRelative, Temporal } from '@charlite/react-temporal';
|
|
100
100
|
|
|
101
101
|
export function RelativeLabel({ instant }: { instant: Temporal.Instant }) {
|
|
102
102
|
const label = useTemporalRelative(Temporal.Now.instant(), instant, 'en');
|
package/docs/installation.md
CHANGED
|
@@ -3,24 +3,24 @@
|
|
|
3
3
|
## npm
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
npm install react-temporal
|
|
6
|
+
npm install @charlite/react-temporal
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
## yarn
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
yarn add react-temporal
|
|
12
|
+
yarn add @charlite/react-temporal
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## pnpm
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
pnpm add react-temporal
|
|
18
|
+
pnpm add @charlite/react-temporal
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
## Peer dependencies
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
`@charlite/react-temporal` expects React to already be installed in your project:
|
|
24
24
|
|
|
25
25
|
| Package | Supported versions |
|
|
26
26
|
| --- | --- |
|
|
@@ -39,7 +39,7 @@ For environments without native Temporal, install **one** of:
|
|
|
39
39
|
|
|
40
40
|
| Package | Size (gzip) | Notes |
|
|
41
41
|
| --- | --- | --- |
|
|
42
|
-
| [`temporal-polyfill`](https://www.npmjs.com/package/temporal-polyfill) | ~20 KB | Recommended; installed automatically with
|
|
42
|
+
| [`temporal-polyfill`](https://www.npmjs.com/package/temporal-polyfill) | ~20 KB | Recommended; installed automatically with `@charlite/react-temporal` |
|
|
43
43
|
| [`@js-temporal/polyfill`](https://www.npmjs.com/package/@js-temporal/polyfill) | ~44 KB | Official reference implementation (install manually if needed) |
|
|
44
44
|
|
|
45
45
|
```bash
|
package/docs/migration.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
### Polyfill default
|
|
6
6
|
|
|
7
|
-
The built-in fallback is now **`temporal-polyfill`** instead of `@js-temporal/polyfill`. No app changes are required unless you relied on `@js-temporal/polyfill` being installed automatically — add it explicitly if you still need it for
|
|
7
|
+
The built-in fallback is now **`temporal-polyfill`** instead of `@js-temporal/polyfill`. No app changes are required unless you relied on `@js-temporal/polyfill` being installed automatically — add it explicitly if you still need it for code outside `@charlite/react-temporal`.
|
|
8
8
|
|
|
9
9
|
### New hooks (optional)
|
|
10
10
|
|
|
@@ -31,7 +31,7 @@ nvm install 26
|
|
|
31
31
|
nvm use 26
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
Update GitHub Actions / CI images to Node 26. End-user apps on older Node versions can still use
|
|
34
|
+
Update GitHub Actions / CI images to Node 26. End-user apps on older Node versions can still use **@charlite/react-temporal** with a Temporal polyfill.
|
|
35
35
|
|
|
36
36
|
### Testing (contributors)
|
|
37
37
|
|
|
@@ -73,7 +73,7 @@ Version **0.0.3** modernizes the library for 2026 Temporal adoption. Most change
|
|
|
73
73
|
**Before (0.0.2):**
|
|
74
74
|
|
|
75
75
|
```bash
|
|
76
|
-
npm install react-temporal
|
|
76
|
+
npm install @charlite/react-temporal
|
|
77
77
|
# react and react-dom were bundled as direct dependencies
|
|
78
78
|
# polyfill was bundled inside the package
|
|
79
79
|
```
|
|
@@ -81,7 +81,7 @@ npm install react-temporal
|
|
|
81
81
|
**After (0.0.3):**
|
|
82
82
|
|
|
83
83
|
```bash
|
|
84
|
-
npm install react-temporal
|
|
84
|
+
npm install @charlite/react-temporal
|
|
85
85
|
npm install temporal-polyfill # recommended for SSR / Safari / Node
|
|
86
86
|
```
|
|
87
87
|
|
|
@@ -92,9 +92,9 @@ Ensure `react` and `react-dom` are in your app's `package.json` (peer dependenci
|
|
|
92
92
|
You can now import `Temporal` from the package instead of `@js-temporal/polyfill`:
|
|
93
93
|
|
|
94
94
|
```diff
|
|
95
|
-
- import { useTemporalMonth } from 'react-temporal';
|
|
95
|
+
- import { useTemporalMonth } from '@charlite/react-temporal';
|
|
96
96
|
- import { Temporal } from '@js-temporal/polyfill';
|
|
97
|
-
+ import { useTemporalMonth, Temporal } from 'react-temporal';
|
|
97
|
+
+ import { useTemporalMonth, Temporal } from '@charlite/react-temporal';
|
|
98
98
|
```
|
|
99
99
|
|
|
100
100
|
### `useTemporalFormat`
|
package/docs/polyfill.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
## How runtime resolution works
|
|
6
6
|
|
|
7
7
|
```ts
|
|
8
|
-
import { getTemporal, Temporal } from 'react-temporal';
|
|
8
|
+
import { getTemporal, Temporal } from '@charlite/react-temporal';
|
|
9
9
|
|
|
10
10
|
// getTemporal() checks globalThis.Temporal first, then falls back to temporal-polyfill
|
|
11
11
|
const T = getTemporal();
|
|
@@ -56,7 +56,7 @@ import 'temporal-polyfill/global';
|
|
|
56
56
|
|
|
57
57
|
- Official reference implementation from Temporal proposal champions
|
|
58
58
|
- Larger (~44 KB gzip)
|
|
59
|
-
- Installed automatically as an optional dependency of
|
|
59
|
+
- Installed automatically as an optional dependency of `@charlite/react-temporal`
|
|
60
60
|
|
|
61
61
|
No global import is required — the package loads it when native Temporal is missing.
|
|
62
62
|
|
|
@@ -74,10 +74,10 @@ In **Vitest** with `jsdom`, native Temporal is typically unavailable. This libra
|
|
|
74
74
|
|
|
75
75
|
**Do I need to import Temporal separately?**
|
|
76
76
|
|
|
77
|
-
No. Import `Temporal` from
|
|
77
|
+
No. Import `Temporal` from `@charlite/react-temporal`:
|
|
78
78
|
|
|
79
79
|
```ts
|
|
80
|
-
import { Temporal } from 'react-temporal';
|
|
80
|
+
import { Temporal } from '@charlite/react-temporal';
|
|
81
81
|
```
|
|
82
82
|
|
|
83
83
|
**Can I use only native Temporal and skip the polyfill?**
|
package/docs/typescript.md
CHANGED
|
@@ -15,14 +15,14 @@ import type {
|
|
|
15
15
|
UseTemporalNowOptions,
|
|
16
16
|
UseTemporalClockOptions,
|
|
17
17
|
TemporalNamespace,
|
|
18
|
-
} from 'react-temporal';
|
|
18
|
+
} from '@charlite/react-temporal';
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
## Importing values and types together
|
|
22
22
|
|
|
23
23
|
```ts
|
|
24
|
-
import { Temporal, useTemporalNow } from 'react-temporal';
|
|
25
|
-
import type { TemporalInstant } from 'react-temporal';
|
|
24
|
+
import { Temporal, useTemporalNow } from '@charlite/react-temporal';
|
|
25
|
+
import type { TemporalInstant } from '@charlite/react-temporal';
|
|
26
26
|
|
|
27
27
|
function logInstant(instant: TemporalInstant) {
|
|
28
28
|
console.log(instant.toString());
|
|
@@ -53,7 +53,7 @@ function logInstant(instant: TemporalInstant) {
|
|
|
53
53
|
## Typing component props
|
|
54
54
|
|
|
55
55
|
```tsx
|
|
56
|
-
import type { TemporalInstant, TemporalPlainDate } from 'react-temporal';
|
|
56
|
+
import type { TemporalInstant, TemporalPlainDate } from '@charlite/react-temporal';
|
|
57
57
|
|
|
58
58
|
interface EventCardProps {
|
|
59
59
|
startsAt: TemporalInstant;
|
|
@@ -70,7 +70,7 @@ export function EventCard({ startsAt, date }: EventCardProps) {
|
|
|
70
70
|
Use this when you need the type of the full `Temporal` namespace:
|
|
71
71
|
|
|
72
72
|
```ts
|
|
73
|
-
import type { TemporalNamespace } from 'react-temporal';
|
|
73
|
+
import type { TemporalNamespace } from '@charlite/react-temporal';
|
|
74
74
|
|
|
75
75
|
function useTemporalSafe(): TemporalNamespace {
|
|
76
76
|
return getTemporal();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@charlite/react-temporal",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "React hooks for date and time using the JavaScript Temporal API — native in modern browsers and Node.js 26+, polyfill-ready elsewhere.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -51,8 +51,7 @@
|
|
|
51
51
|
"url": "git+https://github.com/charlite/react-temporal.git"
|
|
52
52
|
},
|
|
53
53
|
"publishConfig": {
|
|
54
|
-
"access": "public"
|
|
55
|
-
"registry": "https://registry.npmjs.org"
|
|
54
|
+
"access": "public"
|
|
56
55
|
},
|
|
57
56
|
"homepage": "https://github.com/charlite/react-temporal#readme",
|
|
58
57
|
"bugs": {
|
|
@@ -117,4 +116,4 @@
|
|
|
117
116
|
"optionalDependencies": {
|
|
118
117
|
"temporal-polyfill": "^1.0.5"
|
|
119
118
|
}
|
|
120
|
-
}
|
|
119
|
+
}
|