@samline/date 2.1.1 → 2.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 +21 -24
- package/dist/browser/date.global.js +846 -0
- package/dist/browser/date.global.js.map +1 -0
- package/dist/browser/global.js +6 -0
- package/dist/browser/global.js.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/react/index.js +6 -0
- package/dist/react/index.js.map +1 -1
- package/dist/svelte/index.js +6 -0
- package/dist/svelte/index.js.map +1 -1
- package/dist/vanilla/index.js +6 -0
- package/dist/vanilla/index.js.map +1 -1
- package/dist/vue/index.js +6 -0
- package/dist/vue/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ Day.js repository: https://github.com/iamkun/dayjs
|
|
|
19
19
|
## Table of Contents
|
|
20
20
|
|
|
21
21
|
- [Installation](#installation)
|
|
22
|
-
- [
|
|
22
|
+
- [CDN / Browser](#cdn--browser)
|
|
23
23
|
- [Entrypoints](#entrypoints)
|
|
24
24
|
- [Quick Start](#quick-start)
|
|
25
25
|
- [API](#api)
|
|
@@ -47,39 +47,36 @@ yarn add @samline/date
|
|
|
47
47
|
bun add @samline/date
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
##
|
|
50
|
+
## CDN / Browser
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
Use the browser bundle when your project loads scripts directly in the page and cannot compile npm modules.
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
<script type="module">
|
|
56
|
-
import { DateKit } from 'https://cdn.jsdelivr.net/npm/@samline/date@2.1.1/dist/browser/global.js'
|
|
57
|
-
|
|
58
|
-
const value = await DateKit.getDate({
|
|
59
|
-
date: '23/03/2026',
|
|
60
|
-
input: 'DD/MM/YYYY',
|
|
61
|
-
output: 'MMMM D, YYYY'
|
|
62
|
-
})
|
|
54
|
+
This is useful in environments such as Shopify themes, WordPress templates, or plain HTML pages with no build step.
|
|
63
55
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
</script>
|
|
56
|
+
```html
|
|
57
|
+
<script src="https://cdn.jsdelivr.net/npm/@samline/date@2.1.2/dist/browser/date.global.js"></script>
|
|
67
58
|
```
|
|
68
59
|
|
|
69
|
-
|
|
60
|
+
Then use it from a normal script:
|
|
70
61
|
|
|
71
62
|
```html
|
|
72
|
-
<script
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
63
|
+
<script>
|
|
64
|
+
;(async () => {
|
|
65
|
+
const value = await window.DateKit.getDate({
|
|
66
|
+
date: '23/03/2026',
|
|
67
|
+
input: 'DD/MM/YYYY',
|
|
68
|
+
output: 'MMMM D, YYYY'
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
console.log(value)
|
|
72
|
+
console.log(window.DateKit.resolveLocale('en-us'))
|
|
73
|
+
})()
|
|
79
74
|
</script>
|
|
80
75
|
```
|
|
81
76
|
|
|
82
|
-
|
|
77
|
+
After the CDN script loads, the browser build exposes `window.DateKit`.
|
|
78
|
+
|
|
79
|
+
Use one of the package manager commands above when your project has a build step. If you are working in Shopify, WordPress, or any browser-only template without compilation, use the browser bundle described in [docs/browser.md](docs/browser.md).
|
|
83
80
|
|
|
84
81
|
## Entrypoints
|
|
85
82
|
|