fui-material 2.2.3 → 2.2.5

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.
@@ -50198,6 +50198,37 @@ const fFormatRuNumber = (a, options) => {
50198
50198
  }
50199
50199
  return new Intl.NumberFormat("ru-RU", formatOptions).format(processedValue);
50200
50200
  };
50201
+ function fConvertDate(input, options) {
50202
+ const format = (options == null ? void 0 : options.format) ?? "iso";
50203
+ const locale = (options == null ? void 0 : options.locale) ?? "ru-RU";
50204
+ if (input === null || input === void 0 || input === "") {
50205
+ return format === "date" ? void 0 : "";
50206
+ }
50207
+ const date = input instanceof Date ? input : new Date(input);
50208
+ if (isNaN(date.getTime())) {
50209
+ return format === "date" ? void 0 : "";
50210
+ }
50211
+ const pad = (num) => String(num).padStart(2, "0");
50212
+ switch (format) {
50213
+ case "iso":
50214
+ return date.toISOString().slice(0, 10);
50215
+ case "ru":
50216
+ return date.toLocaleDateString("ru-RU");
50217
+ case "ru-datetime": {
50218
+ const dateStr = date.toLocaleDateString("ru-RU");
50219
+ const timeStr = `${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;
50220
+ return `${dateStr} ${timeStr}`;
50221
+ }
50222
+ case "time":
50223
+ return `${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;
50224
+ case "date":
50225
+ return date;
50226
+ case "custom":
50227
+ return new Intl.DateTimeFormat(locale, options == null ? void 0 : options.customOptions).format(date);
50228
+ default:
50229
+ return "";
50230
+ }
50231
+ }
50201
50232
  function bind(fn, thisArg) {
50202
50233
  return function wrap() {
50203
50234
  return fn.apply(thisArg, arguments);
@@ -52698,6 +52729,7 @@ export {
52698
52729
  fAlert,
52699
52730
  fBankRound,
52700
52731
  fConfirm,
52732
+ fConvertDate,
52701
52733
  fConvertFileToBase64,
52702
52734
  fDownloadBlobFile,
52703
52735
  fDownloadFileFromBase64,