|
1 | 1 | <script setup lang="ts"> |
2 | | -interface NuxtTimeProps { |
3 | | - datetime: string | number | Date |
4 | | - localeMatcher?: 'best fit' | 'lookup' |
5 | | - weekday?: 'long' | 'short' | 'narrow' |
6 | | - era?: 'long' | 'short' | 'narrow' |
7 | | - year?: 'numeric' | '2-digit' |
8 | | - month?: 'numeric' | '2-digit' | 'long' | 'short' | 'narrow' |
9 | | - day?: 'numeric' | '2-digit' |
10 | | - hour?: 'numeric' | '2-digit' |
11 | | - minute?: 'numeric' | '2-digit' |
12 | | - second?: 'numeric' | '2-digit' |
13 | | - timeZoneName?: 'short' | 'long' | 'shortOffset' | 'longOffset' | 'shortGeneric' | 'longGeneric' |
14 | | - formatMatcher?: 'best fit' | 'basic' |
15 | | - hour12?: boolean |
16 | | - timeZone?: string |
17 | | -
|
18 | | - calendar?: string |
19 | | - dayPeriod?: 'narrow' | 'short' | 'long' |
20 | | - numberingSystem?: string |
21 | | -
|
22 | | - dateStyle?: 'full' | 'long' | 'medium' | 'short' |
23 | | - timeStyle?: 'full' | 'long' | 'medium' | 'short' |
24 | | - hourCycle?: 'h11' | 'h12' | 'h23' | 'h24' |
25 | | -
|
26 | | - numeric?: 'always' | 'auto' |
27 | | - relativeStyle?: 'long' | 'short' | 'narrow' |
28 | | -} |
| 2 | +import type { NuxtTimeProps } from 'nuxt/app' |
| 3 | +
|
| 4 | +interface DateTimeProps extends Omit<NuxtTimeProps, 'title' | 'relative' | 'locale'> {} |
29 | 5 |
|
30 | | -const props = withDefaults(defineProps<NuxtTimeProps>(), { |
| 6 | +const props = withDefaults(defineProps<DateTimeProps>(), { |
31 | 7 | hour12: undefined, |
32 | 8 | }) |
33 | 9 |
|
@@ -129,6 +105,7 @@ if (import.meta.server) { |
129 | 105 | } |
130 | 106 | onPrehydrate(el => { |
131 | 107 | const now = (window._nuxtTimeNow ||= Date.now()) |
| 108 | + // eslint-disable-next-line eslint-plugin-unicorn/consistent-function-scoping |
132 | 109 | const toCamelCase = (name: string, index: number) => { |
133 | 110 | if (index > 0) { |
134 | 111 | return name[0]!.toUpperCase() + name.slice(1) |
|
0 commit comments