@superdispatch/dates 0.21.8 → 0.21.14
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-types/index.d.ts +237 -237
- package/package.json +32 -32
package/dist-types/index.d.ts
CHANGED
|
@@ -6,261 +6,261 @@ import { ColorVariant } from '@superdispatch/ui';
|
|
|
6
6
|
import { DayPickerProps } from 'react-day-picker';
|
|
7
7
|
import { DateTime, ToRelativeOptions, ToRelativeUnit } from 'luxon';
|
|
8
8
|
|
|
9
|
-
declare function setDefaultTimeZone(offset: number | 'local'): string;
|
|
10
|
-
declare function useDefaultTimeZone(offset: number | 'local'): string;
|
|
11
|
-
declare type DateFormat = 'DateISO' | 'DateTimeISO' | 'JodaISO';
|
|
12
|
-
interface DateConfig {
|
|
13
|
-
readonly format: DateFormat;
|
|
14
|
-
}
|
|
15
|
-
declare const defaultDateConfig: DateConfig;
|
|
16
|
-
declare function useDateConfig(options?: Partial<DateConfig>): DateConfig;
|
|
17
|
-
interface DateConfigProviderProps extends Partial<DateConfig> {
|
|
18
|
-
children?: ReactNode;
|
|
19
|
-
}
|
|
9
|
+
declare function setDefaultTimeZone(offset: number | 'local'): string;
|
|
10
|
+
declare function useDefaultTimeZone(offset: number | 'local'): string;
|
|
11
|
+
declare type DateFormat = 'DateISO' | 'DateTimeISO' | 'JodaISO';
|
|
12
|
+
interface DateConfig {
|
|
13
|
+
readonly format: DateFormat;
|
|
14
|
+
}
|
|
15
|
+
declare const defaultDateConfig: DateConfig;
|
|
16
|
+
declare function useDateConfig(options?: Partial<DateConfig>): DateConfig;
|
|
17
|
+
interface DateConfigProviderProps extends Partial<DateConfig> {
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
}
|
|
20
20
|
declare function DateConfigProvider({ format, children, }: DateConfigProviderProps): ReactElement;
|
|
21
21
|
|
|
22
|
-
declare type DateDisplayVariant = 'Date' | 'ShortDate' | 'Time' | 'DateTime';
|
|
23
|
-
declare type DateString = string;
|
|
24
|
-
declare type NullableDateString = null | undefined | DateString;
|
|
25
|
-
declare type PrimitiveDateInput = number | DateString;
|
|
26
|
-
declare type NullableDateInput = null | undefined | Date | DateTime | PrimitiveDateInput;
|
|
27
|
-
declare function toPrimitiveDateInput(input: NullableDateInput): PrimitiveDateInput;
|
|
28
|
-
declare function parseDate(input: NullableDateInput, { format }?: DateConfig): DateTime;
|
|
29
|
-
declare function stringifyDate(input: NullableDateInput, config?: DateConfig): string | null;
|
|
30
|
-
interface FormatDateConfig {
|
|
31
|
-
fallback?: string;
|
|
32
|
-
variant: DateDisplayVariant;
|
|
33
|
-
}
|
|
34
|
-
declare function formatDate(input: NullableDateInput, { variant, fallback }: FormatDateConfig, config?: DateConfig): string;
|
|
35
|
-
interface FormatRelativeTimeOptions extends Pick<ToRelativeOptions, 'round' | 'padding'> {
|
|
36
|
-
fallback?: string;
|
|
37
|
-
unit?: ToRelativeUnit;
|
|
38
|
-
base?: NullableDateInput;
|
|
39
|
-
}
|
|
40
|
-
declare function formatRelativeTime(input: NullableDateInput, { round, unit: unitOption, base: baseOption, padding: paddingOption, fallback, }?: FormatRelativeTimeOptions, config?: DateConfig): string;
|
|
41
|
-
interface DatePayload {
|
|
42
|
-
readonly config: DateConfig;
|
|
43
|
-
readonly dateValue: DateTime;
|
|
44
|
-
readonly stringValue: null | DateString;
|
|
45
|
-
}
|
|
46
|
-
declare function toDatePayload(input: NullableDateInput, config?: DateConfig): DatePayload;
|
|
47
|
-
declare type DateTimeRange = [null | DateTime, null | DateTime];
|
|
48
|
-
declare type DateStringRange = [null | DateString, null | DateString];
|
|
49
|
-
declare type NullableDateRangeInput = null | undefined | [NullableDateInput?, NullableDateInput?];
|
|
50
|
-
declare type PrimitiveDateRangeInput = [
|
|
51
|
-
undefined | PrimitiveDateInput,
|
|
52
|
-
undefined | PrimitiveDateInput
|
|
53
|
-
];
|
|
54
|
-
declare function toPrimitiveDateRangeInput(input: NullableDateRangeInput): PrimitiveDateRangeInput;
|
|
55
|
-
declare function parseDateRange(input: NullableDateRangeInput, config?: DateConfig): DateTimeRange;
|
|
56
|
-
declare function stringifyDateRange(input: NullableDateRangeInput, config?: DateConfig): DateStringRange;
|
|
57
|
-
interface FormatDateRangeOptions {
|
|
58
|
-
fallback?: string;
|
|
59
|
-
}
|
|
60
|
-
declare function formatDateRange(input: NullableDateRangeInput, { fallback }: FormatDateRangeOptions, config?: DateConfig): string;
|
|
61
|
-
interface DateRangePayload {
|
|
62
|
-
config: DateConfig;
|
|
63
|
-
dateValue: DateTimeRange;
|
|
64
|
-
stringValue: DateStringRange;
|
|
65
|
-
}
|
|
22
|
+
declare type DateDisplayVariant = 'Date' | 'ShortDate' | 'Time' | 'DateTime';
|
|
23
|
+
declare type DateString = string;
|
|
24
|
+
declare type NullableDateString = null | undefined | DateString;
|
|
25
|
+
declare type PrimitiveDateInput = number | DateString;
|
|
26
|
+
declare type NullableDateInput = null | undefined | Date | DateTime | PrimitiveDateInput;
|
|
27
|
+
declare function toPrimitiveDateInput(input: NullableDateInput): PrimitiveDateInput;
|
|
28
|
+
declare function parseDate(input: NullableDateInput, { format }?: DateConfig): DateTime;
|
|
29
|
+
declare function stringifyDate(input: NullableDateInput, config?: DateConfig): string | null;
|
|
30
|
+
interface FormatDateConfig {
|
|
31
|
+
fallback?: string;
|
|
32
|
+
variant: DateDisplayVariant;
|
|
33
|
+
}
|
|
34
|
+
declare function formatDate(input: NullableDateInput, { variant, fallback }: FormatDateConfig, config?: DateConfig): string;
|
|
35
|
+
interface FormatRelativeTimeOptions extends Pick<ToRelativeOptions, 'round' | 'padding'> {
|
|
36
|
+
fallback?: string;
|
|
37
|
+
unit?: ToRelativeUnit;
|
|
38
|
+
base?: NullableDateInput;
|
|
39
|
+
}
|
|
40
|
+
declare function formatRelativeTime(input: NullableDateInput, { round, unit: unitOption, base: baseOption, padding: paddingOption, fallback, }?: FormatRelativeTimeOptions, config?: DateConfig): string;
|
|
41
|
+
interface DatePayload {
|
|
42
|
+
readonly config: DateConfig;
|
|
43
|
+
readonly dateValue: DateTime;
|
|
44
|
+
readonly stringValue: null | DateString;
|
|
45
|
+
}
|
|
46
|
+
declare function toDatePayload(input: NullableDateInput, config?: DateConfig): DatePayload;
|
|
47
|
+
declare type DateTimeRange = [null | DateTime, null | DateTime];
|
|
48
|
+
declare type DateStringRange = [null | DateString, null | DateString];
|
|
49
|
+
declare type NullableDateRangeInput = null | undefined | [NullableDateInput?, NullableDateInput?];
|
|
50
|
+
declare type PrimitiveDateRangeInput = [
|
|
51
|
+
undefined | PrimitiveDateInput,
|
|
52
|
+
undefined | PrimitiveDateInput
|
|
53
|
+
];
|
|
54
|
+
declare function toPrimitiveDateRangeInput(input: NullableDateRangeInput): PrimitiveDateRangeInput;
|
|
55
|
+
declare function parseDateRange(input: NullableDateRangeInput, config?: DateConfig): DateTimeRange;
|
|
56
|
+
declare function stringifyDateRange(input: NullableDateRangeInput, config?: DateConfig): DateStringRange;
|
|
57
|
+
interface FormatDateRangeOptions {
|
|
58
|
+
fallback?: string;
|
|
59
|
+
}
|
|
60
|
+
declare function formatDateRange(input: NullableDateRangeInput, { fallback }: FormatDateRangeOptions, config?: DateConfig): string;
|
|
61
|
+
interface DateRangePayload {
|
|
62
|
+
config: DateConfig;
|
|
63
|
+
dateValue: DateTimeRange;
|
|
64
|
+
stringValue: DateStringRange;
|
|
65
|
+
}
|
|
66
66
|
declare function toDateRangePayload(input: NullableDateRangeInput, config?: DateConfig): DateRangePayload;
|
|
67
67
|
|
|
68
|
-
declare type CalendarDayHighlightColor = Exclude<ColorVariant, 'grey' | 'silver'>;
|
|
69
|
-
declare type CalendarClassNames = keyof NonNullable<DayPickerProps['classNames']> | CalendarDayHighlightColor | 'firstDayOfMonth' | 'lastDayOfMonth';
|
|
70
|
-
declare type CalendarClassNameMap = ClassNameMap<CalendarClassNames>;
|
|
71
|
-
declare type CalendarModifier = (info: DatePayload) => boolean;
|
|
72
|
-
interface CalendarDateEvent extends DatePayload {
|
|
73
|
-
disabled: boolean;
|
|
74
|
-
selected: boolean;
|
|
75
|
-
}
|
|
76
|
-
declare type CalendarDayEventHandler = (event: CalendarDateEvent) => void;
|
|
77
|
-
interface CalendarModifiers {
|
|
78
|
-
today?: CalendarModifier;
|
|
79
|
-
outside?: CalendarModifier;
|
|
80
|
-
[other: string]: undefined | CalendarModifier;
|
|
81
|
-
}
|
|
82
|
-
declare type CalendarHighlightedDays = Partial<Record<CalendarDayHighlightColor, CalendarModifier>>;
|
|
83
|
-
interface CalendarProps extends Pick<DayPickerProps, 'numberOfMonths'> {
|
|
84
|
-
direction?: GridDirection;
|
|
85
|
-
classes?: Partial<CalendarClassNameMap>;
|
|
86
|
-
footer?: ReactNode;
|
|
87
|
-
quickSelection?: ReactNode;
|
|
88
|
-
format?: DateFormat;
|
|
89
|
-
initialTime?: NullableDateInput;
|
|
90
|
-
initialMonth?: NullableDateInput;
|
|
91
|
-
modifiers?: CalendarModifiers;
|
|
92
|
-
selectedDays?: CalendarModifier;
|
|
93
|
-
disabledDays?: CalendarModifier;
|
|
94
|
-
highlightedDays?: CalendarHighlightedDays;
|
|
95
|
-
onDayClick?: CalendarDayEventHandler;
|
|
96
|
-
onDayKeyDown?: CalendarDayEventHandler;
|
|
97
|
-
onDayMouseEnter?: CalendarDayEventHandler;
|
|
98
|
-
onDayMouseLeave?: CalendarDayEventHandler;
|
|
99
|
-
onDayMouseDown?: CalendarDayEventHandler;
|
|
100
|
-
onDayMouseUp?: CalendarDayEventHandler;
|
|
101
|
-
onDayTouchEnd?: CalendarDayEventHandler;
|
|
102
|
-
onDayTouchStart?: CalendarDayEventHandler;
|
|
103
|
-
}
|
|
68
|
+
declare type CalendarDayHighlightColor = Exclude<ColorVariant, 'grey' | 'silver'>;
|
|
69
|
+
declare type CalendarClassNames = keyof NonNullable<DayPickerProps['classNames']> | CalendarDayHighlightColor | 'firstDayOfMonth' | 'lastDayOfMonth';
|
|
70
|
+
declare type CalendarClassNameMap = ClassNameMap<CalendarClassNames>;
|
|
71
|
+
declare type CalendarModifier = (info: DatePayload) => boolean;
|
|
72
|
+
interface CalendarDateEvent extends DatePayload {
|
|
73
|
+
disabled: boolean;
|
|
74
|
+
selected: boolean;
|
|
75
|
+
}
|
|
76
|
+
declare type CalendarDayEventHandler = (event: CalendarDateEvent) => void;
|
|
77
|
+
interface CalendarModifiers {
|
|
78
|
+
today?: CalendarModifier;
|
|
79
|
+
outside?: CalendarModifier;
|
|
80
|
+
[other: string]: undefined | CalendarModifier;
|
|
81
|
+
}
|
|
82
|
+
declare type CalendarHighlightedDays = Partial<Record<CalendarDayHighlightColor, CalendarModifier>>;
|
|
83
|
+
interface CalendarProps extends Pick<DayPickerProps, 'numberOfMonths'> {
|
|
84
|
+
direction?: GridDirection;
|
|
85
|
+
classes?: Partial<CalendarClassNameMap>;
|
|
86
|
+
footer?: ReactNode;
|
|
87
|
+
quickSelection?: ReactNode;
|
|
88
|
+
format?: DateFormat;
|
|
89
|
+
initialTime?: NullableDateInput;
|
|
90
|
+
initialMonth?: NullableDateInput;
|
|
91
|
+
modifiers?: CalendarModifiers;
|
|
92
|
+
selectedDays?: CalendarModifier;
|
|
93
|
+
disabledDays?: CalendarModifier;
|
|
94
|
+
highlightedDays?: CalendarHighlightedDays;
|
|
95
|
+
onDayClick?: CalendarDayEventHandler;
|
|
96
|
+
onDayKeyDown?: CalendarDayEventHandler;
|
|
97
|
+
onDayMouseEnter?: CalendarDayEventHandler;
|
|
98
|
+
onDayMouseLeave?: CalendarDayEventHandler;
|
|
99
|
+
onDayMouseDown?: CalendarDayEventHandler;
|
|
100
|
+
onDayMouseUp?: CalendarDayEventHandler;
|
|
101
|
+
onDayTouchEnd?: CalendarDayEventHandler;
|
|
102
|
+
onDayTouchStart?: CalendarDayEventHandler;
|
|
103
|
+
}
|
|
104
104
|
declare const Calendar: ForwardRefExoticComponent<CalendarProps & RefAttributes<HTMLDivElement>>;
|
|
105
105
|
|
|
106
|
-
interface CalendarQuickSelectionItemProps {
|
|
107
|
-
children?: ReactNode;
|
|
108
|
-
selected?: boolean;
|
|
109
|
-
onClick?: () => void;
|
|
110
|
-
}
|
|
111
|
-
declare const CalendarQuickSelectionItem: ForwardRefExoticComponent<CalendarQuickSelectionItemProps & RefAttributes<HTMLDivElement>>;
|
|
112
|
-
interface CalendarQuickSelectionProps {
|
|
113
|
-
children?: ReactNode;
|
|
114
|
-
}
|
|
106
|
+
interface CalendarQuickSelectionItemProps {
|
|
107
|
+
children?: ReactNode;
|
|
108
|
+
selected?: boolean;
|
|
109
|
+
onClick?: () => void;
|
|
110
|
+
}
|
|
111
|
+
declare const CalendarQuickSelectionItem: ForwardRefExoticComponent<CalendarQuickSelectionItemProps & RefAttributes<HTMLDivElement>>;
|
|
112
|
+
interface CalendarQuickSelectionProps {
|
|
113
|
+
children?: ReactNode;
|
|
114
|
+
}
|
|
115
115
|
declare const CalendarQuickSelection: ForwardRefExoticComponent<CalendarQuickSelectionProps & RefAttributes<HTMLUListElement>>;
|
|
116
116
|
|
|
117
|
-
interface DateFieldAPI extends DatePayload {
|
|
118
|
-
close: () => void;
|
|
119
|
-
change: (value: NullableDateInput) => void;
|
|
120
|
-
}
|
|
121
|
-
interface DateFieldProps extends Pick<BaseTextFieldProps, 'disabled' | 'error' | 'fullWidth' | 'helperText' | 'id' | 'label' | 'name' | 'onClick' | 'onKeyDown' | 'placeholder' | 'required'> {
|
|
122
|
-
format?: DateFormat;
|
|
123
|
-
value?: NullableDateInput;
|
|
124
|
-
onBlur?: () => void;
|
|
125
|
-
onFocus?: () => void;
|
|
126
|
-
onChange?: (event: DatePayload) => void;
|
|
127
|
-
fallback?: string;
|
|
128
|
-
variant?: DateDisplayVariant;
|
|
129
|
-
enableClearable?: boolean;
|
|
130
|
-
disableCloseOnSelect?: boolean;
|
|
131
|
-
renderFooter?: (api: DateFieldAPI) => ReactNode;
|
|
132
|
-
renderQuickSelection?: (api: DateFieldAPI) => ReactNode;
|
|
133
|
-
InputProps?: Pick<InputBaseProps, 'aria-label' | 'aria-labelledby' | 'startAdornment'>;
|
|
134
|
-
CalendarProps?: Omit<CalendarProps, 'classes' | 'footer' | 'initialMonth' | 'numberOfMonths' | 'quickSelection' | 'selectedDays'>;
|
|
135
|
-
}
|
|
117
|
+
interface DateFieldAPI extends DatePayload {
|
|
118
|
+
close: () => void;
|
|
119
|
+
change: (value: NullableDateInput) => void;
|
|
120
|
+
}
|
|
121
|
+
interface DateFieldProps extends Pick<BaseTextFieldProps, 'disabled' | 'error' | 'fullWidth' | 'helperText' | 'id' | 'label' | 'name' | 'onClick' | 'onKeyDown' | 'placeholder' | 'required'> {
|
|
122
|
+
format?: DateFormat;
|
|
123
|
+
value?: NullableDateInput;
|
|
124
|
+
onBlur?: () => void;
|
|
125
|
+
onFocus?: () => void;
|
|
126
|
+
onChange?: (event: DatePayload) => void;
|
|
127
|
+
fallback?: string;
|
|
128
|
+
variant?: DateDisplayVariant;
|
|
129
|
+
enableClearable?: boolean;
|
|
130
|
+
disableCloseOnSelect?: boolean;
|
|
131
|
+
renderFooter?: (api: DateFieldAPI) => ReactNode;
|
|
132
|
+
renderQuickSelection?: (api: DateFieldAPI) => ReactNode;
|
|
133
|
+
InputProps?: Pick<InputBaseProps, 'aria-label' | 'aria-labelledby' | 'startAdornment'>;
|
|
134
|
+
CalendarProps?: Omit<CalendarProps, 'classes' | 'footer' | 'initialMonth' | 'numberOfMonths' | 'quickSelection' | 'selectedDays'>;
|
|
135
|
+
}
|
|
136
136
|
declare const DateField: ForwardRefExoticComponent<DateFieldProps & RefAttributes<HTMLDivElement>>;
|
|
137
137
|
|
|
138
|
-
interface DateRangeFieldAPI extends DateRangePayload {
|
|
139
|
-
close: () => void;
|
|
140
|
-
change: (value: NullableDateRangeInput) => void;
|
|
141
|
-
}
|
|
142
|
-
interface DateRangeFieldProps extends Pick<BaseTextFieldProps, 'disabled' | 'error' | 'fullWidth' | 'helperText' | 'id' | 'label' | 'name' | 'required' | 'placeholder'> {
|
|
143
|
-
fallback?: string;
|
|
144
|
-
enableClearable?: boolean;
|
|
145
|
-
disableCloseOnSelect?: boolean;
|
|
146
|
-
format?: DateFormat;
|
|
147
|
-
value?: NullableDateRangeInput;
|
|
148
|
-
onBlur?: () => void;
|
|
149
|
-
onFocus?: () => void;
|
|
150
|
-
onChange?: (value: DateRangePayload) => void;
|
|
151
|
-
renderFooter?: (api: DateRangeFieldAPI) => ReactNode;
|
|
152
|
-
renderQuickSelection?: (api: DateRangeFieldAPI) => ReactNode;
|
|
153
|
-
InputProps?: Pick<InputBaseProps, 'aria-label' | 'aria-labelledby' | 'startAdornment'>;
|
|
154
|
-
CalendarProps?: Omit<CalendarProps, 'footer' | 'classes' | 'selectedDays' | 'quickSelection' | 'numberOfMonths'>;
|
|
155
|
-
}
|
|
138
|
+
interface DateRangeFieldAPI extends DateRangePayload {
|
|
139
|
+
close: () => void;
|
|
140
|
+
change: (value: NullableDateRangeInput) => void;
|
|
141
|
+
}
|
|
142
|
+
interface DateRangeFieldProps extends Pick<BaseTextFieldProps, 'disabled' | 'error' | 'fullWidth' | 'helperText' | 'id' | 'label' | 'name' | 'required' | 'placeholder'> {
|
|
143
|
+
fallback?: string;
|
|
144
|
+
enableClearable?: boolean;
|
|
145
|
+
disableCloseOnSelect?: boolean;
|
|
146
|
+
format?: DateFormat;
|
|
147
|
+
value?: NullableDateRangeInput;
|
|
148
|
+
onBlur?: () => void;
|
|
149
|
+
onFocus?: () => void;
|
|
150
|
+
onChange?: (value: DateRangePayload) => void;
|
|
151
|
+
renderFooter?: (api: DateRangeFieldAPI) => ReactNode;
|
|
152
|
+
renderQuickSelection?: (api: DateRangeFieldAPI) => ReactNode;
|
|
153
|
+
InputProps?: Pick<InputBaseProps, 'aria-label' | 'aria-labelledby' | 'startAdornment'>;
|
|
154
|
+
CalendarProps?: Omit<CalendarProps, 'footer' | 'classes' | 'selectedDays' | 'quickSelection' | 'numberOfMonths'>;
|
|
155
|
+
}
|
|
156
156
|
declare const DateRangeField: ForwardRefExoticComponent<DateRangeFieldProps & RefAttributes<HTMLDivElement>>;
|
|
157
157
|
|
|
158
|
-
/** @deprecated */
|
|
159
|
-
declare type DateUnit = 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second' | 'millisecond';
|
|
160
|
-
/** @deprecated */
|
|
161
|
-
declare type DateDurationUnit = DateUnit | 'quarter' | 'week';
|
|
162
|
-
/** @deprecated */
|
|
163
|
-
declare type DateObject = Record<DateUnit, number>;
|
|
164
|
-
/** @deprecated */
|
|
165
|
-
declare type NullableDate = null | undefined | Date;
|
|
166
|
-
/** @deprecated */
|
|
167
|
-
declare type DateLike = number | Date;
|
|
168
|
-
/** @deprecated */
|
|
169
|
-
declare type NullableDateLike = null | undefined | DateLike;
|
|
170
|
-
/** @deprecated */
|
|
171
|
-
declare type DateRange = [Date?, Date?];
|
|
172
|
-
/** @deprecated */
|
|
173
|
-
declare type DateRangeLike = [DateLike?, DateLike?];
|
|
174
|
-
/** @deprecated */
|
|
175
|
-
declare type NullableDateRange = null | undefined | [NullableDate?, NullableDate?];
|
|
176
|
-
/** @deprecated */
|
|
177
|
-
declare type NullableDateRangeLike = null | undefined | [NullableDateLike?, NullableDateLike?];
|
|
178
|
-
/** @deprecated */
|
|
179
|
-
declare function isDate(value: unknown): value is Date;
|
|
180
|
-
/** @deprecated */
|
|
181
|
-
declare function isDateLike(value: unknown): value is DateLike;
|
|
182
|
-
/** @deprecated */
|
|
183
|
-
declare function isValidDate(value: unknown): value is Date;
|
|
184
|
-
/** @deprecated */
|
|
185
|
-
declare function isDateRange(range: unknown): range is DateRange;
|
|
186
|
-
/** @deprecated */
|
|
187
|
-
declare function isDateRangeLike(range: unknown): range is DateRangeLike;
|
|
188
|
-
/** @deprecated */
|
|
189
|
-
declare function isValidDateRange(range: unknown): range is DateRange;
|
|
190
|
-
/** @deprecated */
|
|
191
|
-
declare function toDate(value: NullableDateLike): Date;
|
|
192
|
-
/** @deprecated */
|
|
193
|
-
declare function toDateRange(range: NullableDateRangeLike): DateRange;
|
|
194
|
-
/** @deprecated */
|
|
195
|
-
declare type DateFormatVariant = 'date' | 'shortDate' | 'time' | 'dateTime';
|
|
196
|
-
/** @deprecated */
|
|
197
|
-
declare type DateFormatOptions = Omit<Intl.DateTimeFormatOptions, 'timeZone' | 'timeZoneName'>;
|
|
198
|
-
/** @deprecated */
|
|
199
|
-
declare type RelativeTimeFormatStyle = 'narrow' | 'short' | 'long';
|
|
200
|
-
/** @deprecated */
|
|
201
|
-
interface RelativeTimeFormatOptions {
|
|
202
|
-
style?: RelativeTimeFormatStyle;
|
|
203
|
-
compare?: DateLike;
|
|
204
|
-
}
|
|
205
|
-
/** @deprecated */
|
|
206
|
-
declare class DateUtils {
|
|
207
|
-
/** @deprecated */
|
|
208
|
-
toObject(value: DateLike): DateObject;
|
|
209
|
-
/** @deprecated */
|
|
210
|
-
fromObject({ year, month, day, hour, minute, second, millisecond, }: Partial<DateObject>): Date;
|
|
211
|
-
/** @deprecated */
|
|
212
|
-
update(value: DateLike, values: Partial<DateObject>): Date;
|
|
213
|
-
/** @deprecated */
|
|
214
|
-
mergeDateAndTime(date: DateLike, time: DateLike): Date;
|
|
215
|
-
/** @deprecated */
|
|
216
|
-
startOf(value: DateLike, unit: DateDurationUnit): Date;
|
|
217
|
-
/** @deprecated */
|
|
218
|
-
endOf(value: DateLike, unit: DateDurationUnit): Date;
|
|
219
|
-
/** @deprecated */
|
|
220
|
-
plus(value: DateLike, values: Partial<DateObject>): Date;
|
|
221
|
-
/** @deprecated */
|
|
222
|
-
minus(value: DateLike, values: Partial<DateObject>): Date;
|
|
223
|
-
/** @deprecated */
|
|
224
|
-
isSameDate(value: NullableDateLike, compare: NullableDateLike, unit?: DateUnit): boolean;
|
|
225
|
-
/** @deprecated */
|
|
226
|
-
isSameDateRange(value: NullableDateRangeLike, compare: NullableDateRangeLike, unit?: DateUnit): boolean;
|
|
227
|
-
/** @deprecated */
|
|
228
|
-
diff(value: DateLike, compare: DateLike, unit: DateUnit): number;
|
|
229
|
-
/** @deprecated */
|
|
230
|
-
toLocaleString(value: DateLike, options?: DateFormatOptions): string;
|
|
231
|
-
/** @deprecated */
|
|
232
|
-
format(value: DateLike, variant: DateFormatVariant): string;
|
|
233
|
-
/** @deprecated */
|
|
234
|
-
formatRange(value: NullableDateRangeLike, emptyText?: string): string;
|
|
235
|
-
/** @deprecated */
|
|
236
|
-
formatRelativeTime(value: DateLike, { style, compare }?: RelativeTimeFormatOptions): string;
|
|
237
|
-
}
|
|
158
|
+
/** @deprecated */
|
|
159
|
+
declare type DateUnit = 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second' | 'millisecond';
|
|
160
|
+
/** @deprecated */
|
|
161
|
+
declare type DateDurationUnit = DateUnit | 'quarter' | 'week';
|
|
162
|
+
/** @deprecated */
|
|
163
|
+
declare type DateObject = Record<DateUnit, number>;
|
|
164
|
+
/** @deprecated */
|
|
165
|
+
declare type NullableDate = null | undefined | Date;
|
|
166
|
+
/** @deprecated */
|
|
167
|
+
declare type DateLike = number | Date;
|
|
168
|
+
/** @deprecated */
|
|
169
|
+
declare type NullableDateLike = null | undefined | DateLike;
|
|
170
|
+
/** @deprecated */
|
|
171
|
+
declare type DateRange = [Date?, Date?];
|
|
172
|
+
/** @deprecated */
|
|
173
|
+
declare type DateRangeLike = [DateLike?, DateLike?];
|
|
174
|
+
/** @deprecated */
|
|
175
|
+
declare type NullableDateRange = null | undefined | [NullableDate?, NullableDate?];
|
|
176
|
+
/** @deprecated */
|
|
177
|
+
declare type NullableDateRangeLike = null | undefined | [NullableDateLike?, NullableDateLike?];
|
|
178
|
+
/** @deprecated */
|
|
179
|
+
declare function isDate(value: unknown): value is Date;
|
|
180
|
+
/** @deprecated */
|
|
181
|
+
declare function isDateLike(value: unknown): value is DateLike;
|
|
182
|
+
/** @deprecated */
|
|
183
|
+
declare function isValidDate(value: unknown): value is Date;
|
|
184
|
+
/** @deprecated */
|
|
185
|
+
declare function isDateRange(range: unknown): range is DateRange;
|
|
186
|
+
/** @deprecated */
|
|
187
|
+
declare function isDateRangeLike(range: unknown): range is DateRangeLike;
|
|
188
|
+
/** @deprecated */
|
|
189
|
+
declare function isValidDateRange(range: unknown): range is DateRange;
|
|
190
|
+
/** @deprecated */
|
|
191
|
+
declare function toDate(value: NullableDateLike): Date;
|
|
192
|
+
/** @deprecated */
|
|
193
|
+
declare function toDateRange(range: NullableDateRangeLike): DateRange;
|
|
194
|
+
/** @deprecated */
|
|
195
|
+
declare type DateFormatVariant = 'date' | 'shortDate' | 'time' | 'dateTime';
|
|
196
|
+
/** @deprecated */
|
|
197
|
+
declare type DateFormatOptions = Omit<Intl.DateTimeFormatOptions, 'timeZone' | 'timeZoneName'>;
|
|
198
|
+
/** @deprecated */
|
|
199
|
+
declare type RelativeTimeFormatStyle = 'narrow' | 'short' | 'long';
|
|
200
|
+
/** @deprecated */
|
|
201
|
+
interface RelativeTimeFormatOptions {
|
|
202
|
+
style?: RelativeTimeFormatStyle;
|
|
203
|
+
compare?: DateLike;
|
|
204
|
+
}
|
|
205
|
+
/** @deprecated */
|
|
206
|
+
declare class DateUtils {
|
|
207
|
+
/** @deprecated */
|
|
208
|
+
toObject(value: DateLike): DateObject;
|
|
209
|
+
/** @deprecated */
|
|
210
|
+
fromObject({ year, month, day, hour, minute, second, millisecond, }: Partial<DateObject>): Date;
|
|
211
|
+
/** @deprecated */
|
|
212
|
+
update(value: DateLike, values: Partial<DateObject>): Date;
|
|
213
|
+
/** @deprecated */
|
|
214
|
+
mergeDateAndTime(date: DateLike, time: DateLike): Date;
|
|
215
|
+
/** @deprecated */
|
|
216
|
+
startOf(value: DateLike, unit: DateDurationUnit): Date;
|
|
217
|
+
/** @deprecated */
|
|
218
|
+
endOf(value: DateLike, unit: DateDurationUnit): Date;
|
|
219
|
+
/** @deprecated */
|
|
220
|
+
plus(value: DateLike, values: Partial<DateObject>): Date;
|
|
221
|
+
/** @deprecated */
|
|
222
|
+
minus(value: DateLike, values: Partial<DateObject>): Date;
|
|
223
|
+
/** @deprecated */
|
|
224
|
+
isSameDate(value: NullableDateLike, compare: NullableDateLike, unit?: DateUnit): boolean;
|
|
225
|
+
/** @deprecated */
|
|
226
|
+
isSameDateRange(value: NullableDateRangeLike, compare: NullableDateRangeLike, unit?: DateUnit): boolean;
|
|
227
|
+
/** @deprecated */
|
|
228
|
+
diff(value: DateLike, compare: DateLike, unit: DateUnit): number;
|
|
229
|
+
/** @deprecated */
|
|
230
|
+
toLocaleString(value: DateLike, options?: DateFormatOptions): string;
|
|
231
|
+
/** @deprecated */
|
|
232
|
+
format(value: DateLike, variant: DateFormatVariant): string;
|
|
233
|
+
/** @deprecated */
|
|
234
|
+
formatRange(value: NullableDateRangeLike, emptyText?: string): string;
|
|
235
|
+
/** @deprecated */
|
|
236
|
+
formatRelativeTime(value: DateLike, { style, compare }?: RelativeTimeFormatOptions): string;
|
|
237
|
+
}
|
|
238
238
|
declare function useDateUtils(): DateUtils;
|
|
239
239
|
|
|
240
|
-
interface FormattedDateConfig extends Partial<DateConfig>, FormatDateConfig {
|
|
241
|
-
}
|
|
242
|
-
declare function useFormattedDate(input: NullableDateInput, { variant, fallback, ...dateConfig }: FormattedDateConfig): string;
|
|
243
|
-
interface FormattedDateProps extends Omit<FormattedDateConfig, 'fallback'> {
|
|
244
|
-
fallback?: ReactNode;
|
|
245
|
-
date: NullableDateInput;
|
|
246
|
-
}
|
|
240
|
+
interface FormattedDateConfig extends Partial<DateConfig>, FormatDateConfig {
|
|
241
|
+
}
|
|
242
|
+
declare function useFormattedDate(input: NullableDateInput, { variant, fallback, ...dateConfig }: FormattedDateConfig): string;
|
|
243
|
+
interface FormattedDateProps extends Omit<FormattedDateConfig, 'fallback'> {
|
|
244
|
+
fallback?: ReactNode;
|
|
245
|
+
date: NullableDateInput;
|
|
246
|
+
}
|
|
247
247
|
declare function FormattedDate({ date, fallback, ...options }: FormattedDateProps): null | ReactElement;
|
|
248
248
|
|
|
249
|
-
interface FormattedRelativeTimeOptions extends Partial<DateConfig>, FormatRelativeTimeOptions {
|
|
250
|
-
}
|
|
251
|
-
declare function useFormattedRelativeTime(input: NullableDateInput, { unit, round, padding, fallback, base: baseOption, ...dateConfig }?: FormattedRelativeTimeOptions): string;
|
|
252
|
-
interface FormattedRelativeTimeProps extends Omit<FormattedRelativeTimeOptions, 'fallback'> {
|
|
253
|
-
date: NullableDateInput;
|
|
254
|
-
fallback?: ReactNode;
|
|
255
|
-
}
|
|
249
|
+
interface FormattedRelativeTimeOptions extends Partial<DateConfig>, FormatRelativeTimeOptions {
|
|
250
|
+
}
|
|
251
|
+
declare function useFormattedRelativeTime(input: NullableDateInput, { unit, round, padding, fallback, base: baseOption, ...dateConfig }?: FormattedRelativeTimeOptions): string;
|
|
252
|
+
interface FormattedRelativeTimeProps extends Omit<FormattedRelativeTimeOptions, 'fallback'> {
|
|
253
|
+
date: NullableDateInput;
|
|
254
|
+
fallback?: ReactNode;
|
|
255
|
+
}
|
|
256
256
|
declare function FormattedRelativeTime({ date, fallback, ...options }: FormattedRelativeTimeProps): null | ReactElement;
|
|
257
257
|
|
|
258
|
-
interface TimeFieldProps extends Pick<BaseTextFieldProps, 'disabled' | 'error' | 'fullWidth' | 'helperText' | 'id' | 'label' | 'name' | 'placeholder' | 'required'> {
|
|
259
|
-
format?: DateFormat;
|
|
260
|
-
value?: NullableDateInput;
|
|
261
|
-
onChange?: (value: DatePayload) => void;
|
|
262
|
-
InputProps?: Pick<InputBaseProps, 'startAdornment'>;
|
|
263
|
-
}
|
|
258
|
+
interface TimeFieldProps extends Pick<BaseTextFieldProps, 'disabled' | 'error' | 'fullWidth' | 'helperText' | 'id' | 'label' | 'name' | 'placeholder' | 'required'> {
|
|
259
|
+
format?: DateFormat;
|
|
260
|
+
value?: NullableDateInput;
|
|
261
|
+
onChange?: (value: DatePayload) => void;
|
|
262
|
+
InputProps?: Pick<InputBaseProps, 'startAdornment'>;
|
|
263
|
+
}
|
|
264
264
|
declare const TimeField: ForwardRefExoticComponent<TimeFieldProps & RefAttributes<HTMLDivElement>>;
|
|
265
265
|
|
|
266
266
|
declare function useDateTimeRange(input: NullableDateRangeInput, options?: Partial<DateConfig>): DateTimeRange;
|
package/package.json
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@superdispatch/dates",
|
|
3
|
-
"version": "0.21.
|
|
4
|
-
"license": "MIT",
|
|
5
|
-
"files": [
|
|
6
|
-
"dist-*/",
|
|
7
|
-
"bin/"
|
|
8
|
-
],
|
|
9
|
-
"pika": true,
|
|
10
|
-
"sideEffects": false,
|
|
11
|
-
"repository": {
|
|
12
|
-
"type": "git",
|
|
13
|
-
"url": "https://github.com/superdispatch/ui.git"
|
|
14
|
-
},
|
|
15
|
-
"dependencies": {
|
|
16
|
-
"@superdispatch/ui": "^0.21.
|
|
17
|
-
"luxon": "^1.27.0",
|
|
18
|
-
"react-day-picker": "7.4.10"
|
|
19
|
-
},
|
|
20
|
-
"peerDependencies": {
|
|
21
|
-
"@babel/runtime": "^7.0.0",
|
|
22
|
-
"@material-ui/lab": "^4.0.0-alpha.40"
|
|
23
|
-
},
|
|
24
|
-
"publishConfig": {
|
|
25
|
-
"access": "public",
|
|
26
|
-
"directory": "pkg"
|
|
27
|
-
},
|
|
28
|
-
"esnext": "dist-src/index.js",
|
|
29
|
-
"module": "dist-web/index.js",
|
|
30
|
-
"main": "dist-node/index.js",
|
|
31
|
-
"types": "dist-types/index.d.ts"
|
|
32
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@superdispatch/dates",
|
|
3
|
+
"version": "0.21.14",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist-*/",
|
|
7
|
+
"bin/"
|
|
8
|
+
],
|
|
9
|
+
"pika": true,
|
|
10
|
+
"sideEffects": false,
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/superdispatch/ui.git"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@superdispatch/ui": "^0.21.14",
|
|
17
|
+
"luxon": "^1.27.0",
|
|
18
|
+
"react-day-picker": "7.4.10"
|
|
19
|
+
},
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"@babel/runtime": "^7.0.0",
|
|
22
|
+
"@material-ui/lab": "^4.0.0-alpha.40"
|
|
23
|
+
},
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public",
|
|
26
|
+
"directory": "pkg"
|
|
27
|
+
},
|
|
28
|
+
"esnext": "dist-src/index.js",
|
|
29
|
+
"module": "dist-web/index.js",
|
|
30
|
+
"main": "dist-node/index.js",
|
|
31
|
+
"types": "dist-types/index.d.ts"
|
|
32
|
+
}
|