@fr0st/datetime 8.1.0 → 8.1.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.
- package/README.md +15 -13
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Frost DateTime
|
|
2
2
|
|
|
3
|
-
[](https://github.com/frost-js/datetime/actions/workflows/ci.yml)
|
|
4
|
+
[](https://codecov.io/gh/frost-js/datetime)
|
|
5
5
|
[](https://www.npmjs.com/package/@fr0st/datetime)
|
|
6
6
|
[](https://www.npmjs.com/package/@fr0st/datetime)
|
|
7
|
-
[](https://github.com/frost-js/datetime/blob/main/dist/frost-datetime.min.js)
|
|
8
|
+
[](./LICENSE)
|
|
9
9
|
|
|
10
|
-
Immutable date and time handling for JavaScript with locale-aware formatting, parsing, calendar math, and IANA or fixed-offset time zones.
|
|
10
|
+
Immutable date and time handling for JavaScript with locale-aware formatting, parsing, calendar math, and IANA or fixed-offset time zones. Frost DateTime works in Node and bundlers, and also ships a browser-friendly UMD bundle that exposes `globalThis.DateTime`.
|
|
11
11
|
|
|
12
12
|
## Highlights
|
|
13
13
|
|
|
@@ -27,7 +27,7 @@ Immutable date and time handling for JavaScript with locale-aware formatting, pa
|
|
|
27
27
|
npm i @fr0st/datetime
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
Frost DateTime's package entry point is ESM-only. Import the default `DateTime` export in Node and bundlers.
|
|
31
31
|
|
|
32
32
|
```js
|
|
33
33
|
import DateTime from '@fr0st/datetime';
|
|
@@ -55,11 +55,13 @@ Load the bundle from your own copy or a CDN:
|
|
|
55
55
|
<!-- or -->
|
|
56
56
|
<script src="https://cdn.jsdelivr.net/npm/@fr0st/datetime@latest/dist/frost-datetime.min.js"></script>
|
|
57
57
|
<script>
|
|
58
|
-
const date = DateTime.now({ timeZone: 'UTC' });
|
|
58
|
+
const date = globalThis.DateTime.now({ timeZone: 'UTC' });
|
|
59
59
|
console.log(date.toIsoString());
|
|
60
60
|
</script>
|
|
61
61
|
```
|
|
62
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
|
+
|
|
63
65
|
## Quick Start
|
|
64
66
|
|
|
65
67
|
```js
|
|
@@ -83,11 +85,11 @@ nextWeek.monthName();
|
|
|
83
85
|
// March
|
|
84
86
|
```
|
|
85
87
|
|
|
86
|
-
TypeScript note:
|
|
88
|
+
TypeScript note: Frost DateTime is written in JavaScript and uses JSDoc types, which most editors surface as IntelliSense.
|
|
87
89
|
|
|
88
90
|
## Date Model
|
|
89
91
|
|
|
90
|
-
|
|
92
|
+
Frost DateTime revolves around an immutable `DateTime` class and a small set of predictable parsing and formatting rules.
|
|
91
93
|
|
|
92
94
|
- Every setter and manipulation method returns a new instance
|
|
93
95
|
- Constructor numbers are milliseconds since the UNIX epoch
|
|
@@ -111,7 +113,7 @@ new DateTime('January 1, 2019 00:00:00', { timeZone: 'Australia/Brisbane' })
|
|
|
111
113
|
|
|
112
114
|
## API
|
|
113
115
|
|
|
114
|
-
|
|
116
|
+
Frost DateTime exports a default `DateTime` class from `@fr0st/datetime`.
|
|
115
117
|
|
|
116
118
|
### Creating dates
|
|
117
119
|
|
|
@@ -174,7 +176,7 @@ Format tokens are documented in [Formats.md](./Formats.md).
|
|
|
174
176
|
|
|
175
177
|
### Formatting and output
|
|
176
178
|
|
|
177
|
-
- `format(formatString)`: format with
|
|
179
|
+
- `format(formatString)`: format with Frost DateTime's token set
|
|
178
180
|
- `toString()`: `eee MMM dd yyyy HH:mm:ss xx (VV)`
|
|
179
181
|
- `toDateString()`: `eee MMM dd yyyy`
|
|
180
182
|
- `toTimeString()`: `HH:mm:ss xx (VV)`
|
|
@@ -418,4 +420,4 @@ npm run build
|
|
|
418
420
|
|
|
419
421
|
## License
|
|
420
422
|
|
|
421
|
-
|
|
423
|
+
Frost DateTime is released under the [MIT License](./LICENSE).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fr0st/datetime",
|
|
3
|
-
"version": "8.1.
|
|
3
|
+
"version": "8.1.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Immutable date and time handling for JavaScript with locale-aware formatting, parsing, calendar math, and IANA or fixed-offset time zones.",
|
|
6
6
|
"keywords": [
|
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
"parse",
|
|
15
15
|
"format"
|
|
16
16
|
],
|
|
17
|
-
"homepage": "https://github.com/
|
|
17
|
+
"homepage": "https://github.com/frost-js/datetime",
|
|
18
18
|
"bugs": {
|
|
19
|
-
"url": "https://github.com/
|
|
19
|
+
"url": "https://github.com/frost-js/datetime/issues",
|
|
20
20
|
"email": "elusivecodes@gmail.com"
|
|
21
21
|
},
|
|
22
22
|
"repository": {
|
|
23
23
|
"type": "git",
|
|
24
|
-
"url": "git+https://github.com/
|
|
24
|
+
"url": "git+https://github.com/frost-js/datetime.git"
|
|
25
25
|
},
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"author": "Elusive <elusivecodes@gmail.com>",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"test:coverage": "vitest run --coverage"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@fr0st/eslint-config": "^5.0.
|
|
57
|
+
"@fr0st/eslint-config": "^5.0.3",
|
|
58
58
|
"@vitest/coverage-v8": "^4.1.11",
|
|
59
59
|
"eslint": "^10.9.1",
|
|
60
60
|
"vite": "^8.2.2",
|