@nekm/svelte-core 1.1.2 → 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 +14 -13
- package/dist/date-time.svelte.d.ts +3 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- 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,23 +1,24 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
import {localeFormatDate} from "./locale.js";
|
|
4
|
-
|
|
5
|
-
interface Props {
|
|
2
|
+
export interface DateTimeProps {
|
|
6
3
|
readonly date: Date;
|
|
4
|
+
readonly locale?: string;
|
|
7
5
|
}
|
|
8
6
|
|
|
9
|
-
const { date }:
|
|
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
|
+
);
|
|
13
17
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
// locale.
|
|
17
|
-
formatted = localeFormatDate(date);
|
|
18
|
-
})
|
|
18
|
+
return intl.format(date);
|
|
19
|
+
});
|
|
19
20
|
</script>
|
|
20
21
|
|
|
21
|
-
<time datetime={
|
|
22
|
+
<time datetime={date.toISOString()}>
|
|
22
23
|
{formatted}
|
|
23
24
|
</time>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
interface
|
|
1
|
+
export interface DateTimeProps {
|
|
2
2
|
readonly date: Date;
|
|
3
|
+
readonly locale?: string;
|
|
3
4
|
}
|
|
4
|
-
declare const DateTime: import("svelte").Component<
|
|
5
|
+
declare const DateTime: import("svelte").Component<DateTimeProps, {}, "">;
|
|
5
6
|
type DateTime = ReturnType<typeof DateTime>;
|
|
6
7
|
export default DateTime;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
export * from "./google-analytics.js";
|
|
1
2
|
export { default as GoogleAnalytics } from "./google-analytics.svelte";
|
|
2
3
|
export * from "./google-analytics.svelte";
|
|
3
|
-
export * from "./google-analytics.js";
|
|
4
4
|
export { default as Seo } from "./seo.svelte";
|
|
5
5
|
export * from "./seo.svelte";
|
|
6
6
|
export { default as DateTime } from "./date-time.svelte";
|
|
7
|
+
export * from "./date-time.svelte";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
export * from "./google-analytics.js";
|
|
1
2
|
export { default as GoogleAnalytics } from "./google-analytics.svelte";
|
|
2
3
|
export * from "./google-analytics.svelte";
|
|
3
|
-
export * from "./google-analytics.js";
|
|
4
4
|
export { default as Seo } from "./seo.svelte";
|
|
5
5
|
export * from "./seo.svelte";
|
|
6
6
|
export { default as DateTime } from "./date-time.svelte";
|
|
7
|
+
export * from "./date-time.svelte";
|
package/package.json
CHANGED
package/dist/locale.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function localeFormatDate(date: Date, locale?: string): string;
|