@jsenv/navi 0.26.42 → 0.27.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/jsenv_navi.js +34 -31
- package/dist/jsenv_navi.js.map +3 -3
- package/package.json +1 -1
package/dist/jsenv_navi.js
CHANGED
|
@@ -29199,38 +29199,45 @@ const NAVI_NUMBER_TYPE_DEFAULTS = {
|
|
|
29199
29199
|
navi_percentage: { type: "number", min: 0, max: 100, step: 1 },
|
|
29200
29200
|
};
|
|
29201
29201
|
|
|
29202
|
-
const
|
|
29202
|
+
const normalizeToDate = (value) => {
|
|
29203
29203
|
if (value === undefined || value === null) {
|
|
29204
|
+
return null;
|
|
29205
|
+
}
|
|
29206
|
+
if (typeof value === "number") {
|
|
29207
|
+
return new Date(value);
|
|
29208
|
+
}
|
|
29209
|
+
if (value instanceof Date) {
|
|
29204
29210
|
return value;
|
|
29205
29211
|
}
|
|
29206
|
-
|
|
29212
|
+
return null;
|
|
29213
|
+
};
|
|
29214
|
+
|
|
29215
|
+
const toInputDate = (value) => {
|
|
29216
|
+
const date = normalizeToDate(value);
|
|
29217
|
+
if (!date) {
|
|
29207
29218
|
return value;
|
|
29208
29219
|
}
|
|
29209
|
-
const yyyy =
|
|
29210
|
-
const mm = String(
|
|
29211
|
-
const dd = String(
|
|
29220
|
+
const yyyy = date.getFullYear();
|
|
29221
|
+
const mm = String(date.getMonth() + 1).padStart(2, "0");
|
|
29222
|
+
const dd = String(date.getDate()).padStart(2, "0");
|
|
29212
29223
|
return `${yyyy}-${mm}-${dd}`;
|
|
29213
29224
|
};
|
|
29214
29225
|
const toInputMonth = (value) => {
|
|
29215
|
-
|
|
29226
|
+
const date = normalizeToDate(value);
|
|
29227
|
+
if (!date) {
|
|
29216
29228
|
return value;
|
|
29217
29229
|
}
|
|
29218
|
-
|
|
29219
|
-
|
|
29220
|
-
}
|
|
29221
|
-
const yyyy = value.getFullYear();
|
|
29222
|
-
const mm = String(value.getMonth() + 1).padStart(2, "0");
|
|
29230
|
+
const yyyy = date.getFullYear();
|
|
29231
|
+
const mm = String(date.getMonth() + 1).padStart(2, "0");
|
|
29223
29232
|
return `${yyyy}-${mm}`;
|
|
29224
29233
|
};
|
|
29225
29234
|
const toInputWeek = (value) => {
|
|
29226
|
-
|
|
29227
|
-
|
|
29228
|
-
}
|
|
29229
|
-
if (!(value instanceof Date)) {
|
|
29235
|
+
const date = normalizeToDate(value);
|
|
29236
|
+
if (!date) {
|
|
29230
29237
|
return value;
|
|
29231
29238
|
}
|
|
29232
29239
|
// ISO week number
|
|
29233
|
-
const d = new Date(
|
|
29240
|
+
const d = new Date(date);
|
|
29234
29241
|
d.setHours(0, 0, 0, 0);
|
|
29235
29242
|
d.setDate(d.getDate() + 3 - ((d.getDay() + 6) % 7));
|
|
29236
29243
|
const yearStart = new Date(d.getFullYear(), 0, 4);
|
|
@@ -29241,28 +29248,24 @@ const toInputWeek = (value) => {
|
|
|
29241
29248
|
return `${d.getFullYear()}-W${String(week).padStart(2, "0")}`;
|
|
29242
29249
|
};
|
|
29243
29250
|
const toInputTime = (value) => {
|
|
29244
|
-
|
|
29251
|
+
const date = normalizeToDate(value);
|
|
29252
|
+
if (!date) {
|
|
29245
29253
|
return value;
|
|
29246
29254
|
}
|
|
29247
|
-
|
|
29248
|
-
|
|
29249
|
-
}
|
|
29250
|
-
const hh = String(value.getHours()).padStart(2, "0");
|
|
29251
|
-
const mm = String(value.getMinutes()).padStart(2, "0");
|
|
29255
|
+
const hh = String(date.getHours()).padStart(2, "0");
|
|
29256
|
+
const mm = String(date.getMinutes()).padStart(2, "0");
|
|
29252
29257
|
return `${hh}:${mm}`;
|
|
29253
29258
|
};
|
|
29254
29259
|
const toInputDatetime = (value) => {
|
|
29255
|
-
|
|
29256
|
-
|
|
29257
|
-
}
|
|
29258
|
-
if (!(value instanceof Date)) {
|
|
29260
|
+
const date = normalizeToDate(value);
|
|
29261
|
+
if (!date) {
|
|
29259
29262
|
return value;
|
|
29260
29263
|
}
|
|
29261
|
-
const yyyy =
|
|
29262
|
-
const mm = String(
|
|
29263
|
-
const dd = String(
|
|
29264
|
-
const hh = String(
|
|
29265
|
-
const min = String(
|
|
29264
|
+
const yyyy = date.getFullYear();
|
|
29265
|
+
const mm = String(date.getMonth() + 1).padStart(2, "0");
|
|
29266
|
+
const dd = String(date.getDate()).padStart(2, "0");
|
|
29267
|
+
const hh = String(date.getHours()).padStart(2, "0");
|
|
29268
|
+
const min = String(date.getMinutes()).padStart(2, "0");
|
|
29266
29269
|
return `${yyyy}-${mm}-${dd}T${hh}:${min}`;
|
|
29267
29270
|
};
|
|
29268
29271
|
|