Skip to content

Commit 60f6e59

Browse files
committed
refactor: reuse NuxtTimeProps
1 parent fafc84b commit 60f6e59

File tree

1 file changed

+5
-28
lines changed

1 file changed

+5
-28
lines changed

app/components/DateTime.vue

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,9 @@
11
<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'> {}
295
30-
const props = withDefaults(defineProps<NuxtTimeProps>(), {
6+
const props = withDefaults(defineProps<DateTimeProps>(), {
317
hour12: undefined,
328
})
339
@@ -129,6 +105,7 @@ if (import.meta.server) {
129105
}
130106
onPrehydrate(el => {
131107
const now = (window._nuxtTimeNow ||= Date.now())
108+
// eslint-disable-next-line eslint-plugin-unicorn/consistent-function-scoping
132109
const toCamelCase = (name: string, index: number) => {
133110
if (index > 0) {
134111
return name[0]!.toUpperCase() + name.slice(1)

0 commit comments

Comments
 (0)