@rjsf/utils 5.18.6 → 5.19.1
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/index.js +28 -9
- package/dist/index.js.map +3 -3
- package/dist/utils.esm.js +28 -9
- package/dist/utils.esm.js.map +3 -3
- package/dist/utils.umd.js +28 -9
- package/lib/dateRangeOptions.d.ts +11 -0
- package/lib/dateRangeOptions.js +28 -0
- package/lib/dateRangeOptions.js.map +1 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/dateRangeOptions.ts +31 -0
- package/src/index.ts +2 -0
package/dist/index.js
CHANGED
|
@@ -66,6 +66,7 @@ __export(src_exports, {
|
|
|
66
66
|
createErrorHandler: () => createErrorHandler,
|
|
67
67
|
createSchemaUtils: () => createSchemaUtils,
|
|
68
68
|
dataURItoBlob: () => dataURItoBlob,
|
|
69
|
+
dateRangeOptions: () => dateRangeOptions,
|
|
69
70
|
deepEquals: () => deepEquals,
|
|
70
71
|
descriptionId: () => descriptionId,
|
|
71
72
|
englishStringTranslator: () => englishStringTranslator,
|
|
@@ -1906,6 +1907,33 @@ function dataURItoBlob(dataURILike) {
|
|
|
1906
1907
|
}
|
|
1907
1908
|
}
|
|
1908
1909
|
|
|
1910
|
+
// src/pad.ts
|
|
1911
|
+
function pad(num, width) {
|
|
1912
|
+
let s = String(num);
|
|
1913
|
+
while (s.length < width) {
|
|
1914
|
+
s = "0" + s;
|
|
1915
|
+
}
|
|
1916
|
+
return s;
|
|
1917
|
+
}
|
|
1918
|
+
|
|
1919
|
+
// src/dateRangeOptions.ts
|
|
1920
|
+
function dateRangeOptions(start, stop) {
|
|
1921
|
+
if (start <= 0 && stop <= 0) {
|
|
1922
|
+
start = (/* @__PURE__ */ new Date()).getFullYear() + start;
|
|
1923
|
+
stop = (/* @__PURE__ */ new Date()).getFullYear() + stop;
|
|
1924
|
+
} else if (start < 0 || stop < 0) {
|
|
1925
|
+
throw new Error(`Both start (${start}) and stop (${stop}) must both be <= 0 or > 0, got one of each`);
|
|
1926
|
+
}
|
|
1927
|
+
if (start > stop) {
|
|
1928
|
+
return dateRangeOptions(stop, start).reverse();
|
|
1929
|
+
}
|
|
1930
|
+
const options = [];
|
|
1931
|
+
for (let i = start; i <= stop; i++) {
|
|
1932
|
+
options.push({ value: i, label: pad(i, 2) });
|
|
1933
|
+
}
|
|
1934
|
+
return options;
|
|
1935
|
+
}
|
|
1936
|
+
|
|
1909
1937
|
// src/replaceStringParameters.ts
|
|
1910
1938
|
function replaceStringParameters(inputString, params) {
|
|
1911
1939
|
let output = inputString;
|
|
@@ -2403,15 +2431,6 @@ function orderProperties(properties, order) {
|
|
|
2403
2431
|
return complete;
|
|
2404
2432
|
}
|
|
2405
2433
|
|
|
2406
|
-
// src/pad.ts
|
|
2407
|
-
function pad(num, width) {
|
|
2408
|
-
let s = String(num);
|
|
2409
|
-
while (s.length < width) {
|
|
2410
|
-
s = "0" + s;
|
|
2411
|
-
}
|
|
2412
|
-
return s;
|
|
2413
|
-
}
|
|
2414
|
-
|
|
2415
2434
|
// src/parseDateString.ts
|
|
2416
2435
|
function parseDateString(dateString, includeTime = true) {
|
|
2417
2436
|
if (!dateString) {
|