@fr0st/datetime 8.0.3 → 8.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/README.md +20 -4
- package/dist/frost-datetime.esm.js +3251 -0
- package/dist/frost-datetime.esm.js.map +1 -0
- package/dist/frost-datetime.esm.min.js +2 -0
- package/dist/frost-datetime.esm.min.js.map +1 -0
- package/dist/frost-datetime.js +3257 -3885
- package/dist/frost-datetime.js.map +1 -1
- package/dist/frost-datetime.min.js +1 -1
- package/dist/frost-datetime.min.js.map +1 -1
- package/package.json +19 -14
package/README.md
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
# FrostDateTime
|
|
2
2
|
|
|
3
3
|
[](https://github.com/elusivecodes/FrostDateTime/actions/workflows/ci.yml)
|
|
4
|
+
[](https://codecov.io/gh/elusivecodes/FrostDateTime)
|
|
4
5
|
[](https://www.npmjs.com/package/@fr0st/datetime)
|
|
5
6
|
[](https://www.npmjs.com/package/@fr0st/datetime)
|
|
6
|
-
[](https://github.com/elusivecodes/FrostDateTime/blob/main/dist/frost-datetime.min.js)
|
|
7
8
|
[](./LICENSE)
|
|
8
9
|
|
|
9
10
|
Immutable date and time handling for JavaScript with locale-aware formatting, parsing, calendar math, and IANA or fixed-offset time zones. FrostDateTime works in Node and bundlers, and also ships a browser-friendly UMD bundle that exposes `globalThis.DateTime`.
|
|
@@ -11,7 +12,7 @@ Immutable date and time handling for JavaScript with locale-aware formatting, pa
|
|
|
11
12
|
## Highlights
|
|
12
13
|
|
|
13
14
|
- Default ESM `DateTime` export for Node and bundlers
|
|
14
|
-
-
|
|
15
|
+
- Prebuilt ESM and UMD bundles in `dist/`
|
|
15
16
|
- No runtime dependencies
|
|
16
17
|
- Immutable operations across getters, setters, and date math
|
|
17
18
|
- Locale-aware formatting, parsing, relative time, and week rules through `Intl`
|
|
@@ -26,12 +27,25 @@ Immutable date and time handling for JavaScript with locale-aware formatting, pa
|
|
|
26
27
|
npm i @fr0st/datetime
|
|
27
28
|
```
|
|
28
29
|
|
|
29
|
-
FrostDateTime is ESM-only. Import the default `DateTime` export in Node and bundlers.
|
|
30
|
+
FrostDateTime's package entry point is ESM-only. Import the default `DateTime` export in Node and bundlers.
|
|
30
31
|
|
|
31
32
|
```js
|
|
32
33
|
import DateTime from '@fr0st/datetime';
|
|
33
34
|
```
|
|
34
35
|
|
|
36
|
+
### Browser (ESM)
|
|
37
|
+
|
|
38
|
+
Import the minified ESM bundle directly from a CDN:
|
|
39
|
+
|
|
40
|
+
```html
|
|
41
|
+
<script type="module">
|
|
42
|
+
import DateTime from 'https://cdn.jsdelivr.net/npm/@fr0st/datetime@latest/dist/frost-datetime.esm.min.js';
|
|
43
|
+
|
|
44
|
+
const date = DateTime.now({ timeZone: 'UTC' });
|
|
45
|
+
console.log(date.toIsoString());
|
|
46
|
+
</script>
|
|
47
|
+
```
|
|
48
|
+
|
|
35
49
|
### Browser (UMD)
|
|
36
50
|
|
|
37
51
|
Load the bundle from your own copy or a CDN:
|
|
@@ -41,11 +55,13 @@ Load the bundle from your own copy or a CDN:
|
|
|
41
55
|
<!-- or -->
|
|
42
56
|
<script src="https://cdn.jsdelivr.net/npm/@fr0st/datetime@latest/dist/frost-datetime.min.js"></script>
|
|
43
57
|
<script>
|
|
44
|
-
const date = DateTime.now({ timeZone: 'UTC' });
|
|
58
|
+
const date = globalThis.DateTime.now({ timeZone: 'UTC' });
|
|
45
59
|
console.log(date.toIsoString());
|
|
46
60
|
</script>
|
|
47
61
|
```
|
|
48
62
|
|
|
63
|
+
The package root resolves to the prebuilt ESM bundle. Published files under `dist/` and `src/` are also available through matching package subpaths.
|
|
64
|
+
|
|
49
65
|
## Quick Start
|
|
50
66
|
|
|
51
67
|
```js
|