@rjsf/core 5.18.5 → 5.19.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.
@@ -1,9 +1,9 @@
1
1
  import { MouseEvent, useCallback, useEffect, useReducer, useState } from 'react';
2
2
  import {
3
3
  ariaDescribedByIds,
4
+ dateRangeOptions,
4
5
  parseDateString,
5
6
  toDateString,
6
- pad,
7
7
  DateObject,
8
8
  type DateElementFormat,
9
9
  FormContextType,
@@ -14,14 +14,6 @@ import {
14
14
  getDateElementProps,
15
15
  } from '@rjsf/utils';
16
16
 
17
- function rangeOptions(start: number, stop: number) {
18
- const options = [];
19
- for (let i = start; i <= stop; i++) {
20
- options.push({ value: i, label: pad(i, 2) });
21
- }
22
- return options;
23
- }
24
-
25
17
  function readyForChange(state: DateObject) {
26
18
  return Object.values(state).every((value) => value !== -1);
27
19
  }
@@ -58,7 +50,7 @@ function DateElement<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends
58
50
  id={id}
59
51
  name={name}
60
52
  className='form-control'
61
- options={{ enumOptions: rangeOptions(range[0], range[1]) }}
53
+ options={{ enumOptions: dateRangeOptions<S>(range[0], range[1]) }}
62
54
  placeholder={type}
63
55
  value={value}
64
56
  disabled={disabled}