@nekm/svelte-core 1.1.3 → 1.1.4
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 +12 -5
- package/package.json +1 -1
- package/dist/locale.d.ts +0 -1
- package/dist/locale.js +0 -7
package/dist/date-time.svelte
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {localeFormatDate} from "./locale.js";
|
|
3
|
-
|
|
4
2
|
export interface DateTimeProps {
|
|
5
3
|
readonly date: Date;
|
|
6
4
|
readonly locale?: string;
|
|
@@ -8,10 +6,19 @@
|
|
|
8
6
|
|
|
9
7
|
const { date, locale }: DateTimeProps = $props();
|
|
10
8
|
|
|
11
|
-
const
|
|
12
|
-
|
|
9
|
+
const formatted = $derived.by(() => {
|
|
10
|
+
const intl = Intl.DateTimeFormat(
|
|
11
|
+
locale,
|
|
12
|
+
{
|
|
13
|
+
dateStyle: "medium",
|
|
14
|
+
timeStyle: "short"
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
return intl.format(date);
|
|
19
|
+
});
|
|
13
20
|
</script>
|
|
14
21
|
|
|
15
|
-
<time datetime={
|
|
22
|
+
<time datetime={date.toISOString()}>
|
|
16
23
|
{formatted}
|
|
17
24
|
</time>
|
package/package.json
CHANGED
package/dist/locale.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function localeFormatDate(date: Date, locale?: string): string;
|