@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.
@@ -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 isoString = $derived(date.toISOString());
12
- const formatted = $derived(localeFormatDate(date, locale));
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={isoString}>
22
+ <time datetime={date.toISOString()}>
16
23
  {formatted}
17
24
  </time>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nekm/svelte-core",
3
3
  "description": "Code I find myself re-writing over-and-over, Svelte edition.",
4
- "version": "1.1.3",
4
+ "version": "1.1.4",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
7
7
  "build": "vite build && npm run prepack",
package/dist/locale.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare function localeFormatDate(date: Date, locale?: string): string;
package/dist/locale.js DELETED
@@ -1,7 +0,0 @@
1
- export function localeFormatDate(date, locale) {
2
- const intl = Intl.DateTimeFormat(locale, {
3
- dateStyle: "medium",
4
- timeStyle: "short"
5
- });
6
- return intl.format(date);
7
- }