@rjsf/utils 5.18.6 → 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.
- 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/utils.esm.js
CHANGED
|
@@ -1770,6 +1770,33 @@ function dataURItoBlob(dataURILike) {
|
|
|
1770
1770
|
}
|
|
1771
1771
|
}
|
|
1772
1772
|
|
|
1773
|
+
// src/pad.ts
|
|
1774
|
+
function pad(num, width) {
|
|
1775
|
+
let s = String(num);
|
|
1776
|
+
while (s.length < width) {
|
|
1777
|
+
s = "0" + s;
|
|
1778
|
+
}
|
|
1779
|
+
return s;
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
// src/dateRangeOptions.ts
|
|
1783
|
+
function dateRangeOptions(start, stop) {
|
|
1784
|
+
if (start <= 0 && stop <= 0) {
|
|
1785
|
+
start = (/* @__PURE__ */ new Date()).getFullYear() + start;
|
|
1786
|
+
stop = (/* @__PURE__ */ new Date()).getFullYear() + stop;
|
|
1787
|
+
} else if (start < 0 || stop < 0) {
|
|
1788
|
+
throw new Error(`Both start (${start}) and stop (${stop}) must both be <= 0 or > 0, got one of each`);
|
|
1789
|
+
}
|
|
1790
|
+
if (start > stop) {
|
|
1791
|
+
return dateRangeOptions(stop, start).reverse();
|
|
1792
|
+
}
|
|
1793
|
+
const options = [];
|
|
1794
|
+
for (let i = start; i <= stop; i++) {
|
|
1795
|
+
options.push({ value: i, label: pad(i, 2) });
|
|
1796
|
+
}
|
|
1797
|
+
return options;
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1773
1800
|
// src/replaceStringParameters.ts
|
|
1774
1801
|
function replaceStringParameters(inputString, params) {
|
|
1775
1802
|
let output = inputString;
|
|
@@ -2267,15 +2294,6 @@ function orderProperties(properties, order) {
|
|
|
2267
2294
|
return complete;
|
|
2268
2295
|
}
|
|
2269
2296
|
|
|
2270
|
-
// src/pad.ts
|
|
2271
|
-
function pad(num, width) {
|
|
2272
|
-
let s = String(num);
|
|
2273
|
-
while (s.length < width) {
|
|
2274
|
-
s = "0" + s;
|
|
2275
|
-
}
|
|
2276
|
-
return s;
|
|
2277
|
-
}
|
|
2278
|
-
|
|
2279
2297
|
// src/parseDateString.ts
|
|
2280
2298
|
function parseDateString(dateString, includeTime = true) {
|
|
2281
2299
|
if (!dateString) {
|
|
@@ -2656,6 +2674,7 @@ export {
|
|
|
2656
2674
|
createErrorHandler,
|
|
2657
2675
|
createSchemaUtils,
|
|
2658
2676
|
dataURItoBlob,
|
|
2677
|
+
dateRangeOptions,
|
|
2659
2678
|
deepEquals,
|
|
2660
2679
|
descriptionId,
|
|
2661
2680
|
englishStringTranslator,
|