diff --git a/packages/core/src/useDateTimeField/temporalPartial.ts b/packages/core/src/useDateTimeField/temporalPartial.ts index c5dd5016..29e60a31 100644 --- a/packages/core/src/useDateTimeField/temporalPartial.ts +++ b/packages/core/src/useDateTimeField/temporalPartial.ts @@ -4,17 +4,17 @@ import { CalendarIdentifier } from '../useCalendar'; import { isObject } from '../../../shared/src'; export function createTemporalPartial(calendar: CalendarIdentifier, timeZone: string) { - const zonedDateTime = Temporal.Now.zonedDateTime(calendar, timeZone); + const zonedDateTime = Temporal.Now.zonedDateTime(calendar, timeZone) as TemporalPartial; zonedDateTime['~fw_temporal_partial'] = {}; - return zonedDateTime as TemporalPartial; + return zonedDateTime; } export function toTemporalPartial( value: Temporal.ZonedDateTime | TemporalPartial, setParts?: DateTimeSegmentType[], ): TemporalPartial { - const clone = Temporal.ZonedDateTime.from(value); + const clone = Temporal.ZonedDateTime.from(value) as TemporalPartial; clone['~fw_temporal_partial'] = isTemporalPartial(value) ? value['~fw_temporal_partial'] : {}; if (setParts) { setParts.forEach(part => { @@ -22,11 +22,11 @@ export function toTemporalPartial( }); } - return clone as TemporalPartial; + return clone; } export function isTemporalPartial(value: Temporal.ZonedDateTime): value is TemporalPartial { - return isObject(value['~fw_temporal_partial']); + return isObject((value as TemporalPartial)['~fw_temporal_partial']); } export function isTemporalPartSet(value: TemporalPartial, part: DateTimeSegmentType): boolean { diff --git a/packages/core/src/useDateTimeField/types.ts b/packages/core/src/useDateTimeField/types.ts index e235e2a7..b5b66367 100644 --- a/packages/core/src/useDateTimeField/types.ts +++ b/packages/core/src/useDateTimeField/types.ts @@ -30,5 +30,4 @@ export type TemporalPartial = Temporal.ZonedDateTime & { [`~fw_temporal_partial`]: { [key: string]: boolean | undefined; }; - [`~fw_temporal_full_partial`]?: true; }; diff --git a/packages/core/src/useDateTimeField/useDateTimeSegmentGroup.ts b/packages/core/src/useDateTimeField/useDateTimeSegmentGroup.ts index dd6d650c..9f3c6144 100644 --- a/packages/core/src/useDateTimeField/useDateTimeSegmentGroup.ts +++ b/packages/core/src/useDateTimeField/useDateTimeSegmentGroup.ts @@ -295,7 +295,7 @@ function useDateArithmetic({ currentDate }: ArithmeticInit) { }); if (isTemporalPartial(date)) { - newDate['~fw_temporal_partial'] = { + (newDate as TemporalPartial)['~fw_temporal_partial'] = { ...date['~fw_temporal_partial'], [part]: true, }; @@ -334,7 +334,7 @@ function useDateArithmetic({ currentDate }: ArithmeticInit) { }); } - newDate['~fw_temporal_partial'] = { + (newDate as TemporalPartial)['~fw_temporal_partial'] = { ...date['~fw_temporal_partial'], [part]: true, };