Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"@deephaven/utils": "file:../utils",
"@fortawesome/fontawesome-svg-core": "^6.2.1",
"@fortawesome/react-fontawesome": "^0.2.0",
"@internationalized/date": "^3.5.5",
"@react-spectrum/theme-default": "^3.5.1",
"@react-spectrum/utils": "^3.11.5",
"@react-types/radio": "^3.8.1",
Expand Down
18 changes: 18 additions & 0 deletions packages/components/src/spectrum/dateAndTime.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
import {
CalendarDate,
CalendarDateTime,
ZonedDateTime,
} from '@internationalized/date';

export {
Calendar,
type SpectrumCalendarProps as CalendarProps,
Expand All @@ -12,3 +18,15 @@ export {
TimeField,
type SpectrumTimeFieldProps as TimeFieldProps,
} from '@adobe/react-spectrum';

export type { CalendarDate, CalendarDateTime, ZonedDateTime };

export type DateValue = CalendarDate | CalendarDateTime | ZonedDateTime;

export type MappedDateValue<T> = T extends ZonedDateTime
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably add a comment on these types describing why we need them.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed an update with some comments.

? ZonedDateTime
: T extends CalendarDateTime
? CalendarDateTime
: T extends CalendarDate
? CalendarDate
: never;