@bagelink/vue 1.9.54 → 1.9.59
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/composables/index.d.ts +3 -4
- package/dist/composables/index.d.ts.map +1 -1
- package/dist/i18n/index.d.ts +7 -8
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/index.cjs +35 -35
- package/dist/index.mjs +4310 -4297
- package/dist/style.css +1 -1
- package/dist/utils/calendar/dateUtils.d.ts +2 -2
- package/dist/utils/calendar/dateUtils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Spreadsheet/Index.vue +2 -2
- package/src/components/calendar/views/AgendaView.vue +1 -1
- package/src/components/calendar/views/DayView.vue +3 -3
- package/src/components/calendar/views/MonthView.vue +1 -1
- package/src/components/calendar/views/WeekView.vue +6 -6
- package/src/components/form/inputs/DateInput.vue +1 -1
- package/src/composables/index.ts +28 -20
- package/src/i18n/index.ts +21 -15
- package/src/utils/calendar/dateUtils.ts +17 -4
|
@@ -52,7 +52,7 @@ export declare function getDatePartsMap(date: Date, locale: Intl.LocalesArgument
|
|
|
52
52
|
YYYY: string;
|
|
53
53
|
};
|
|
54
54
|
export interface FormatDateOptions extends Partial<Pick<Intl.DateTimeFormatOptions, 'hour12'>> {
|
|
55
|
-
|
|
55
|
+
format?: DateTimeAcceptedFormats;
|
|
56
56
|
locale?: Intl.LocalesArgument;
|
|
57
57
|
tz?: string;
|
|
58
58
|
}
|
|
@@ -67,7 +67,7 @@ export declare function formatDate(date?: DateLike, format?: DateTimeAcceptedFor
|
|
|
67
67
|
* Formats a date based on the provided options.
|
|
68
68
|
* @param date The date to format (string or Date object).
|
|
69
69
|
* @param opts Options for formatting the date.
|
|
70
|
-
* @param opts.
|
|
70
|
+
* @param opts.format The format string (default is 'DD.MM.YY').
|
|
71
71
|
* @param opts.locale The locale to use for formatting (default is browser's locale).
|
|
72
72
|
* @param opts.tz The timezone to use for formatting (default is local timezone).
|
|
73
73
|
* @returns Formatted date string.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/calendar/dateUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,KAAK,EAAE,uBAAuB,EAAY,MAAM,sBAAsB,CAAA;AAG7E,UAAU,gBAAgB;IACzB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;CACb;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,EAAE,gBAAgB,QA+BvE;AAED,KAAK,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AA2E1D,wBAAgB,OAAO,CACtB,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,YAAY,CAAC,EAAE,WAAW,GAAG;IAAE,IAAI,CAAC,EAAE,WAAW,CAAC;IAAC,IAAI,CAAC,EAAE,UAAU,GAAG,UAAU,CAAA;CAAE,UA0EnF;
|
|
1
|
+
{"version":3,"file":"dateUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/calendar/dateUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,KAAK,EAAE,uBAAuB,EAAY,MAAM,sBAAsB,CAAA;AAG7E,UAAU,gBAAgB;IACzB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;CACb;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,EAAE,gBAAgB,QA+BvE;AAED,KAAK,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AA2E1D,wBAAgB,OAAO,CACtB,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,YAAY,CAAC,EAAE,WAAW,GAAG;IAAE,IAAI,CAAC,EAAE,WAAW,CAAC;IAAC,IAAI,CAAC,EAAE,UAAU,GAAG,UAAU,CAAA;CAAE,UA0EnF;AAsBD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,qBAAqB,GAAG,IAAI,CA2CtF;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC,EAAE,IAAI,CAAC,qBAAqB;;;;;;;;;;;;;;EAyB/G;AAcD,MAAM,WAAW,iBAAkB,SAAQ,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,QAAQ,CAAC,CAAC;IAC7F,MAAM,CAAC,EAAE,uBAAuB,CAAA;IAChC,MAAM,CAAC,EAAE,IAAI,CAAC,eAAe,CAAA;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAA;CACX;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,uBAAuB,GAAG,MAAM,CAAA;AAErF;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAAA;AAkG7E,eAAO,MAAM,OAAO,mBAAa,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { Btn, CheckInput, TextInput, ToggleInput,
|
|
2
|
+
import { Btn, CheckInput, TextInput, ToggleInput, useLocalStore, ListItem, Dropdown, useI18n } from '@bagelink/vue'
|
|
3
3
|
import { computed, ref, watch, nextTick, onUnmounted } from 'vue'
|
|
4
4
|
import SpreadsheetTable from './SpreadsheetTable.vue'
|
|
5
5
|
|
|
@@ -229,7 +229,7 @@ interface CellPosition {
|
|
|
229
229
|
const isSelecting = ref(false)
|
|
230
230
|
const selectionStart = ref<CellPosition | null>(null)
|
|
231
231
|
const selectionEnd = ref<CellPosition | null>(null)
|
|
232
|
-
const wrapText =
|
|
232
|
+
const { wrapText } = useLocalStore()
|
|
233
233
|
|
|
234
234
|
// Reactive variable to track the currently editing cell
|
|
235
235
|
const editingCell = ref<CellPosition | null>(null)
|
|
@@ -165,7 +165,7 @@ onUnmounted(() => {
|
|
|
165
165
|
>
|
|
166
166
|
<div class="event-content">
|
|
167
167
|
<div class="event-time">
|
|
168
|
-
{{ formatDate(event.start_time, {
|
|
168
|
+
{{ formatDate(event.start_time, { format: 'HH:mm' }) }}
|
|
169
169
|
</div>
|
|
170
170
|
<div class="event-details">
|
|
171
171
|
<div class="event-title">
|
|
@@ -233,7 +233,7 @@ onUnmounted(() => {
|
|
|
233
233
|
{{ event.title }}
|
|
234
234
|
</div>
|
|
235
235
|
<div class="event-time opacity-8">
|
|
236
|
-
{{ formatDate(new Date(event.start_time), {
|
|
236
|
+
{{ formatDate(new Date(event.start_time), { format: 'HH:mm' }) }} - {{ formatDate(new Date(event.end_time), { format: 'HH:mm' }) }}
|
|
237
237
|
</div>
|
|
238
238
|
</div>
|
|
239
239
|
</div>
|
|
@@ -251,9 +251,9 @@ onUnmounted(() => {
|
|
|
251
251
|
}"
|
|
252
252
|
>
|
|
253
253
|
<div class="color-primary txt-12 p-025">
|
|
254
|
-
{{ dragState.startTime ? formatDate(dragState.startTime, {
|
|
254
|
+
{{ dragState.startTime ? formatDate(dragState.startTime, { format: 'HH:mm' }) : '' }}
|
|
255
255
|
-
|
|
256
|
-
{{ dragState.endTime ? formatDate(dragState.endTime, {
|
|
256
|
+
{{ dragState.endTime ? formatDate(dragState.endTime, { format: 'HH:mm' }) : '' }}
|
|
257
257
|
</div>
|
|
258
258
|
</div>
|
|
259
259
|
</div>
|
|
@@ -122,7 +122,7 @@ function handleEventSelection(event: CalendarEvent, domEvent?: MouseEvent) {
|
|
|
122
122
|
}"
|
|
123
123
|
>
|
|
124
124
|
<div class="day-number">
|
|
125
|
-
{{ formatDate(day.date, {
|
|
125
|
+
{{ formatDate(day.date, { format: 'DD' }) }}
|
|
126
126
|
</div>
|
|
127
127
|
<div class="day-events">
|
|
128
128
|
<template v-if="isMobile">
|
|
@@ -432,14 +432,14 @@ onUnmounted(() => {
|
|
|
432
432
|
<div ref="calendarGrid" class="weekGrid border-bottom me-1">
|
|
433
433
|
<div />
|
|
434
434
|
<div v-for="day in weekDays" :key="day.toISOString()" class="day-header p-05 txt-center m_txt12">
|
|
435
|
-
{{ formatDate(day, {
|
|
435
|
+
{{ formatDate(day, { format: 'DDD' }) }}
|
|
436
436
|
<span
|
|
437
437
|
class="txt-12 round p-025" :class="{
|
|
438
438
|
'color-gray': day.toDateString() !== new Date().toDateString(),
|
|
439
439
|
'bg-primary color-white': day.toDateString() === new Date().toDateString(),
|
|
440
440
|
}"
|
|
441
441
|
>
|
|
442
|
-
{{ formatDate(day, {
|
|
442
|
+
{{ formatDate(day, { format: 'DD' }) }}
|
|
443
443
|
</span>
|
|
444
444
|
</div>
|
|
445
445
|
</div>
|
|
@@ -487,8 +487,8 @@ onUnmounted(() => {
|
|
|
487
487
|
{{ event.title }}
|
|
488
488
|
</div>
|
|
489
489
|
<div class="txt10 opacity-8 user-select-none">
|
|
490
|
-
{{ formatDate(event.start_time, {
|
|
491
|
-
{
|
|
490
|
+
{{ formatDate(event.start_time, { format: 'HH:mm' }) }} - {{ formatDate(event.end_time,
|
|
491
|
+
{ format: 'HH:mm' }) }}
|
|
492
492
|
</div>
|
|
493
493
|
</div>
|
|
494
494
|
</div>
|
|
@@ -507,9 +507,9 @@ onUnmounted(() => {
|
|
|
507
507
|
}"
|
|
508
508
|
>
|
|
509
509
|
<div class="color-primary txt-12 p-025">
|
|
510
|
-
{{ dragState.startTime ? formatDate(dragState.startTime, {
|
|
510
|
+
{{ dragState.startTime ? formatDate(dragState.startTime, { format: 'HH:mm' }) : '' }} - {{
|
|
511
511
|
dragState.endTime
|
|
512
|
-
? formatDate(dragState.endTime, {
|
|
512
|
+
? formatDate(dragState.endTime, { format: 'HH:mm' }) : '' }}
|
|
513
513
|
</div>
|
|
514
514
|
</div>
|
|
515
515
|
</div>
|
|
@@ -48,7 +48,7 @@ const isOpen = ref(false)
|
|
|
48
48
|
// Formatting utilities
|
|
49
49
|
function formatDisplayDate(date: Date | string | undefined): string {
|
|
50
50
|
if (date === undefined || date === '') return ''
|
|
51
|
-
return formatDate(date, {
|
|
51
|
+
return formatDate(date, { format: props.enableTime ? 'DD.MM.YY HH:mm' : 'DD.MM.YY' })
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
function parseUserInput(input: string): Date | null {
|
package/src/composables/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { BglFormSchemaT
|
|
1
|
+
import type { BglFormSchemaT } from '@bagelink/vue'
|
|
2
2
|
|
|
3
|
-
import type { MaybeRefOrGetter, Ref
|
|
3
|
+
import type { MaybeRefOrGetter, Ref } from 'vue'
|
|
4
4
|
import { getFallbackSchema } from '@bagelink/vue'
|
|
5
5
|
import { computed, ref, toValue, watch } from 'vue'
|
|
6
6
|
|
|
@@ -9,6 +9,32 @@ export { useDevice } from './useDevice'
|
|
|
9
9
|
export { useExcel } from './useExcel'
|
|
10
10
|
export { usePolling } from './usePolling'
|
|
11
11
|
export { useTheme } from './useTheme'
|
|
12
|
+
|
|
13
|
+
const _localStoreCache: Record<string, Ref> = {}
|
|
14
|
+
let _storageListenerRegistered = false
|
|
15
|
+
|
|
16
|
+
export function useLocalStore() {
|
|
17
|
+
if (!_storageListenerRegistered) {
|
|
18
|
+
_storageListenerRegistered = true
|
|
19
|
+
window.addEventListener('storage', (e) => {
|
|
20
|
+
if (e.key && _localStoreCache[e.key]) {
|
|
21
|
+
_localStoreCache[e.key].value = e.newValue !== null ? JSON.parse(e.newValue) : null
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
return new Proxy({} as Record<string, Ref>, {
|
|
26
|
+
get(_, key: string) {
|
|
27
|
+
if (!_localStoreCache[key]) {
|
|
28
|
+
const stored = localStorage.getItem(key)
|
|
29
|
+
_localStoreCache[key] = ref(stored !== null ? JSON.parse(stored) : null)
|
|
30
|
+
watch(_localStoreCache[key], (val) => {
|
|
31
|
+
localStorage.setItem(key, JSON.stringify(val))
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
return _localStoreCache[key]
|
|
35
|
+
},
|
|
36
|
+
})
|
|
37
|
+
}
|
|
12
38
|
interface UseBglSchemaParamsT<T> {
|
|
13
39
|
schema?: MaybeRefOrGetter<BglFormSchemaT<T>>
|
|
14
40
|
columns?: MaybeRefOrGetter<string[]>
|
|
@@ -31,22 +57,4 @@ export function useBglSchema<T = { [key: string]: unknown }>(
|
|
|
31
57
|
return getFallbackSchema(data, _columns.value)
|
|
32
58
|
}
|
|
33
59
|
|
|
34
|
-
export function localRef<T>(
|
|
35
|
-
key: string,
|
|
36
|
-
initialValue: T
|
|
37
|
-
): [T] extends [Ref<any, any>] ?
|
|
38
|
-
IfAny<T, Ref<T, T>, T> :
|
|
39
|
-
Ref<UnwrapRef<T>, T | UnwrapRef<T>> {
|
|
40
|
-
const storedValue = localStorage.getItem(key)
|
|
41
|
-
const initial = storedValue !== null ? JSON.parse(storedValue) : initialValue
|
|
42
|
-
const value = ref<T>(initial)
|
|
43
|
-
|
|
44
|
-
watch(() => value.value, (val) => {
|
|
45
|
-
localStorage.setItem(key, JSON.stringify(val))
|
|
46
|
-
}, { immediate: true, deep: true })
|
|
47
|
-
|
|
48
|
-
return value as any
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export const useLocalStorage = localRef
|
|
52
60
|
export { useValidateFieldValue } from './useValidateFieldValue'
|
package/src/i18n/index.ts
CHANGED
|
@@ -20,42 +20,48 @@ const bagelinkLocales = {
|
|
|
20
20
|
} as const
|
|
21
21
|
|
|
22
22
|
export interface CreateBagelI18nOptions {
|
|
23
|
-
/**
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
availableLangs?: string[]
|
|
29
|
-
/** User's custom messages (merged with bagelink's) */
|
|
23
|
+
/** Active locale (default: 'en'). Same as vue-i18n's `locale`. */
|
|
24
|
+
locale?: string
|
|
25
|
+
/** Fallback locale (default: 'en'). Same as vue-i18n's `fallbackLocale`. */
|
|
26
|
+
fallbackLocale?: string
|
|
27
|
+
/** User's custom messages merged with bagelink's built-in translations. Same as vue-i18n's `messages`. */
|
|
30
28
|
messages?: Record<string, Record<string, unknown>>
|
|
31
29
|
}
|
|
32
30
|
|
|
33
31
|
let i18nInstance: I18n | null = null
|
|
34
32
|
|
|
35
33
|
/**
|
|
36
|
-
* Creates an i18n instance with bagelink's translations merged with user's
|
|
34
|
+
* Creates an i18n instance with bagelink's translations merged with user's.
|
|
35
|
+
* Options mirror vue-i18n's `createI18n` for consistency.
|
|
37
36
|
*/
|
|
38
37
|
export function createI18n(options: CreateBagelI18nOptions = {}): I18n {
|
|
39
38
|
const {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
availableLangs = Object.keys(bagelinkLocales),
|
|
39
|
+
locale = 'en',
|
|
40
|
+
fallbackLocale = 'en',
|
|
43
41
|
messages = {},
|
|
44
42
|
} = options
|
|
45
43
|
|
|
46
|
-
// Merge bagelink locales with user messages
|
|
44
|
+
// Merge bagelink locales with user messages for all supported locales
|
|
45
|
+
const supportedLocales = Object.keys(bagelinkLocales)
|
|
47
46
|
const mergedMessages: Record<string, Record<string, unknown>> = {}
|
|
48
47
|
|
|
49
|
-
for (const lang of
|
|
48
|
+
for (const lang of supportedLocales) {
|
|
50
49
|
mergedMessages[lang] = {
|
|
51
50
|
...(bagelinkLocales[lang as keyof typeof bagelinkLocales] || {}),
|
|
52
51
|
...(messages[lang] || {}),
|
|
53
52
|
}
|
|
54
53
|
}
|
|
55
54
|
|
|
55
|
+
// Also include any user-provided locales not in bagelink's built-ins
|
|
56
|
+
for (const lang of Object.keys(messages)) {
|
|
57
|
+
if (!mergedMessages[lang]) {
|
|
58
|
+
mergedMessages[lang] = messages[lang]
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
56
62
|
i18nInstance = createVueI18n({
|
|
57
|
-
locale
|
|
58
|
-
fallbackLocale
|
|
63
|
+
locale,
|
|
64
|
+
fallbackLocale,
|
|
59
65
|
messages: mergedMessages as any,
|
|
60
66
|
legacy: false,
|
|
61
67
|
globalInjection: true,
|
|
@@ -219,6 +219,19 @@ function getBrowserNavigatorLocale(): string {
|
|
|
219
219
|
: navigator.language
|
|
220
220
|
}
|
|
221
221
|
|
|
222
|
+
/**
|
|
223
|
+
* Returns the active i18n locale if initialized, otherwise falls back to
|
|
224
|
+
* the browser's navigator locale. Used as the default for formatDate.
|
|
225
|
+
*/
|
|
226
|
+
function getActiveLocale(): string {
|
|
227
|
+
try {
|
|
228
|
+
const { locale } = getI18n().global
|
|
229
|
+
return typeof locale === 'string' ? locale : locale.value
|
|
230
|
+
} catch {
|
|
231
|
+
return getBrowserNavigatorLocale()
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
222
235
|
/**
|
|
223
236
|
* Adjust a date for a specific timezone
|
|
224
237
|
* @param date The date to adjust
|
|
@@ -310,7 +323,7 @@ const _orderedDateTokens = (
|
|
|
310
323
|
const _tokenRegExPattern = new RegExp(_orderedDateTokens.map(token => token).join('|'), 'g')
|
|
311
324
|
|
|
312
325
|
export interface FormatDateOptions extends Partial<Pick<Intl.DateTimeFormatOptions, 'hour12'>> {
|
|
313
|
-
|
|
326
|
+
format?: DateTimeAcceptedFormats
|
|
314
327
|
locale?: Intl.LocalesArgument
|
|
315
328
|
tz?: string
|
|
316
329
|
}
|
|
@@ -327,7 +340,7 @@ export function formatDate(date?: DateLike, format?: DateTimeAcceptedFormats): s
|
|
|
327
340
|
* Formats a date based on the provided options.
|
|
328
341
|
* @param date The date to format (string or Date object).
|
|
329
342
|
* @param opts Options for formatting the date.
|
|
330
|
-
* @param opts.
|
|
343
|
+
* @param opts.format The format string (default is 'DD.MM.YY').
|
|
331
344
|
* @param opts.locale The locale to use for formatting (default is browser's locale).
|
|
332
345
|
* @param opts.tz The timezone to use for formatting (default is local timezone).
|
|
333
346
|
* @returns Formatted date string.
|
|
@@ -355,7 +368,7 @@ export function formatDate(
|
|
|
355
368
|
format = formatOrOpts
|
|
356
369
|
} else if (formatOrOpts && typeof formatOrOpts === 'object') {
|
|
357
370
|
// Second overload: options object
|
|
358
|
-
format = formatOrOpts.
|
|
371
|
+
format = formatOrOpts.format
|
|
359
372
|
locale = formatOrOpts.locale
|
|
360
373
|
timeZone = formatOrOpts.tz
|
|
361
374
|
rest = formatOrOpts
|
|
@@ -364,7 +377,7 @@ export function formatDate(
|
|
|
364
377
|
if (!date) { return '' }
|
|
365
378
|
format = format || 'DD.MM.YY'
|
|
366
379
|
|
|
367
|
-
locale = locale ||
|
|
380
|
+
locale = locale || getActiveLocale()
|
|
368
381
|
try {
|
|
369
382
|
// Validate the date
|
|
370
383
|
const d = typeof date === 'string' || typeof date === 'number' ? new Date(date) : date
|