@nekm/svelte-core 1.0.22 → 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/dist/date-time.svelte +21 -0
- package/dist/date-time.svelte.d.ts +6 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/locale.d.ts +1 -0
- package/dist/locale.js +7 -0
- package/package.json +1 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import {onMount} from "svelte";
|
|
3
|
+
import {localeFormatDate} from "./locale.js";
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
readonly date: Date;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const { date }: Props = $props();
|
|
10
|
+
|
|
11
|
+
const isoString = date.toISOString();
|
|
12
|
+
let formatted = $state(isoString);
|
|
13
|
+
|
|
14
|
+
onMount(() => {
|
|
15
|
+
formatted = localeFormatDate(date);
|
|
16
|
+
})
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<time datetime={isoString}>
|
|
20
|
+
{formatted}
|
|
21
|
+
</time>
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/locale.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function localeFormatDate(date: Date, locale?: string): string;
|
package/dist/locale.js
ADDED
package/package.json
CHANGED