@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 CHANGED
@@ -1,9 +1,10 @@
1
1
  # FrostDateTime
2
2
 
3
3
  [![CI](https://github.com/elusivecodes/FrostDateTime/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/elusivecodes/FrostDateTime/actions/workflows/ci.yml)
4
+ [![codecov](https://codecov.io/gh/elusivecodes/FrostDateTime/branch/main/graph/badge.svg)](https://codecov.io/gh/elusivecodes/FrostDateTime)
4
5
  [![npm version](https://img.shields.io/npm/v/%40fr0st%2Fdatetime?style=flat-square)](https://www.npmjs.com/package/@fr0st/datetime)
5
6
  [![npm downloads](https://img.shields.io/npm/dm/%40fr0st%2Fdatetime?style=flat-square)](https://www.npmjs.com/package/@fr0st/datetime)
6
- [![minzipped size](https://img.shields.io/bundlejs/size/%40fr0st/datetime?format=minzip&style=flat-square)](https://bundlejs.com/?q=@fr0st/datetime)
7
+ [![JS gzip size](https://img.badgesize.io/elusivecodes/FrostDateTime/main/dist/frost-datetime.min.js?compression=gzip&label=JS%20gzip%20size&style=flat-square)](https://github.com/elusivecodes/FrostDateTime/blob/main/dist/frost-datetime.min.js)
7
8
  [![license](https://img.shields.io/github/license/elusivecodes/FrostDateTime?style=flat-square)](./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
- - Browser UMD bundle in `dist/` exposed as `globalThis.DateTime`
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