@spscommerce/ds-react 8.5.0 → 8.6.0

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.
@@ -14,6 +14,7 @@ export declare type SpsDateRangePickerProps = React.PropsWithChildren<SpsGlobalP
14
14
  onPresetChange?: (newPreset?: string) => void;
15
15
  value?: SimpleDateRange | DatePreset;
16
16
  showTwoMonths?: boolean;
17
+ format?: string;
17
18
  }> & React.HTMLAttributes<HTMLInputElement>;
18
19
  export declare const DEFAULT_PRESETS: DatePreset[];
19
- export declare function SpsDateRangePicker({ children, className, disabled, formMeta, id, maxDate, minDate, onChange, presets, selectedPreset: presetProp, onPresetChange, value, showTwoMonths, "data-testid": testId, ...rest }: SpsDateRangePickerProps): React.JSX.Element;
20
+ export declare function SpsDateRangePicker({ children, className, disabled, formMeta, id, maxDate, minDate, onChange, presets, selectedPreset: presetProp, onPresetChange, value, showTwoMonths, format, "data-testid": testId, ...rest }: SpsDateRangePickerProps): React.JSX.Element;
@@ -12,6 +12,7 @@ export declare type SpsDateTimeRangePickerProps = React.PropsWithChildren<SpsGlo
12
12
  value?: SimpleMomentRange;
13
13
  showTwoMonths?: boolean;
14
14
  twentyFourHour?: boolean;
15
+ format?: string;
15
16
  }> & React.HTMLAttributes<HTMLInputElement>;
16
17
  export declare const DEFAULT_DATETIME_PRESETS: DateTimePreset[];
17
- export declare function SpsDateTimeRangePicker({ className, disabled, formMeta, id, maxDate, minDate, onChange, presets, value, showTwoMonths, twentyFourHour, "data-testid": testId, }: SpsDateTimeRangePickerProps): React.JSX.Element;
18
+ export declare function SpsDateTimeRangePicker({ className, disabled, formMeta, id, maxDate, minDate, onChange, presets, value, showTwoMonths, twentyFourHour, format, "data-testid": testId, }: SpsDateTimeRangePickerProps): React.JSX.Element;
@@ -10,5 +10,6 @@ export declare type SpsDatepickerProps = React.PropsWithChildren<SpsGlobalPropTy
10
10
  minDate?: SimpleDate;
11
11
  onChange?: (newDate: SimpleDate) => void;
12
12
  value?: SimpleDate;
13
+ format?: string;
13
14
  }> & React.HTMLAttributes<HTMLInputElement>;
14
- export declare function SpsDatepicker({ children, className, disabled, formMeta, id, maxDate, minDate, onChange, value, "data-testid": testId, ...rest }: SpsDatepickerProps): React.JSX.Element;
15
+ export declare function SpsDatepicker({ children, className, disabled, formMeta, id, maxDate, minDate, onChange, value, format, "data-testid": testId, ...rest }: SpsDatepickerProps): React.JSX.Element;
@@ -3,19 +3,22 @@ import type { Moment } from "moment-timezone";
3
3
  export declare const FORMAT = "MM/DD/YYYY";
4
4
  export declare const FORMAT_WITH_TIME = "MM/DD/YYYY hh:mm A";
5
5
  export declare const FORMAT_WITH_TIME_24 = "MM/DD/YYYY HH:mm";
6
+ export declare const TIME_FORMAT = "hh:mm A";
7
+ export declare const TIME_FORMAT_24 = "HH:mm";
6
8
  export declare const FORMAT_PATTERN: RegExp;
7
9
  export declare const SYMBOL_DATE_PARSE_ERROR: unique symbol;
8
10
  export declare const SimpleDateUtils: Readonly<{
9
- createFrom(input?: string | Moment | null): SimpleDate | null;
10
- createMomentFrom(input: string | Moment | SimpleDate): Moment | null;
11
- createRangeFrom(input: string): SimpleDateRange | null;
11
+ createFrom(input?: string | Moment | null, format?: string): SimpleDate | null;
12
+ createMomentFrom(input: string | Moment | SimpleDate, format?: string): Moment | null;
13
+ getRangeSeparator(format?: string): string;
14
+ createRangeFrom(input: string, format?: string): SimpleDateRange | null;
12
15
  isValid(date?: SimpleDate | Moment | null): boolean | undefined;
13
16
  nullifyInvalidDate(value: any): SimpleDate | null;
14
17
  toMoment(date?: Moment | SimpleDate | null): Moment | null;
15
- toString(date?: Moment | SimpleDate | null): string;
16
- toStringRange(dateRange: SimpleDateRange): string;
17
- toDateTimeString(dateMoment: Moment | null, twentyFourHourFormat?: boolean): string;
18
- toDateTimeStringRange(dateRange: SimpleMomentRange, twentyFourHourFormat?: boolean): string;
18
+ toString(date?: Moment | SimpleDate | null, format?: string): string;
19
+ toStringRange(dateRange: SimpleDateRange, format?: string): string;
20
+ toDateTimeString(dateMoment: Moment | null, twentyFourHourFormat?: boolean, dateFormat?: string): string;
21
+ toDateTimeStringRange(dateRange: SimpleMomentRange, twentyFourHourFormat?: boolean, dateFormat?: string): string;
19
22
  create(): SimpleDate;
20
23
  isSameDate(d1: SimpleDate, d2: SimpleDate): boolean;
21
24
  isSameMonth(d1: SimpleDate, d2: SimpleDate): boolean;
@@ -24,9 +27,9 @@ export declare const SimpleDateUtils: Readonly<{
24
27
  isInRange(date: SimpleDate, range: SimpleDateRange, inclusive?: boolean): boolean | 0 | null;
25
28
  prevMonth(date: SimpleDate): SimpleDate;
26
29
  nextMonth(date: SimpleDate): SimpleDate;
27
- createRangeFromPreset(preset: DatePreset): SimpleDateRange;
30
+ createRangeFromPreset(preset: DatePreset, format?: string): SimpleDateRange;
28
31
  createDateTimeRangeFromPreset(preset: DateTimePreset): SimpleMomentRange;
29
- splitMomentInDateTimeParts(dateMoment?: Moment | null, twentyFourHourFormat?: boolean): [string, string, string | undefined];
32
+ splitMomentInDateTimeParts(dateMoment?: Moment | null, twentyFourHourFormat?: boolean, dateFormat?: string): [string, string, string | undefined];
30
33
  getCurrentMoment(): Moment;
31
34
  validateTimeString(timeString?: string, twentyFourHourFormat?: boolean): boolean;
32
35
  padIncompleteTimeString(timeString?: string, twentyFourHourFormat?: boolean): string;
@@ -1,6 +1,7 @@
1
1
  import type { SimpleDate, SimpleDateRange, SimpleMomentRange } from "@spscommerce/ds-shared";
2
2
  import type { Duration, Moment } from "moment-timezone";
3
3
  import type { SpsValidator, SpsValidatorFactory } from "../form/validation/types";
4
+ export declare function setDateFormat(format: string): void;
4
5
  export declare const date: SpsValidator<SimpleDate | SimpleDateRange | Moment | SimpleMomentRange | null>;
5
6
  export declare const dateRange: SpsValidator<SimpleDateRange | Duration | SimpleMomentRange>;
6
7
  export interface DateConstraintError {
@@ -12,6 +12,7 @@ export declare const SpsValidators: Readonly<{
12
12
  numeric: SpsValidator<string>;
13
13
  nonNumeric: SpsValidator<string>;
14
14
  OnBlurErrorKeys: Set<string>;
15
+ setDateFormat(format: string): void;
15
16
  date: SpsValidator<import("@spscommerce/ds-shared").SimpleDate | import("moment").Moment | import("@spscommerce/ds-shared").SimpleDateRange | import("@spscommerce/ds-shared").SimpleMomentRange | null>;
16
17
  dateRange: SpsValidator<import("@spscommerce/ds-shared").SimpleDateRange | import("@spscommerce/ds-shared").SimpleMomentRange | import("moment").Duration>;
17
18
  dateConstraint: SpsValidatorFactory<import("@spscommerce/ds-shared").SimpleDate | import("moment").Moment | import("@spscommerce/ds-shared").SimpleDateRange | import("@spscommerce/ds-shared").SimpleMomentRange>;