fui-material 2.2.2 → 2.2.4

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.
@@ -50171,12 +50171,24 @@ function fBankRound(value, decimalPlaces) {
50171
50171
  return +roundedValue.toFixed(decimalPlaces);
50172
50172
  }
50173
50173
  const fFormatRuNumber = (a, options) => {
50174
- if (typeof a !== "number" || isNaN(a)) return "";
50174
+ if (typeof a !== "number" || isNaN(a)) return (options == null ? void 0 : options.returnNumber) ? NaN : "";
50175
50175
  let processedValue = a;
50176
50176
  if (options == null ? void 0 : options.useBankRound) {
50177
- const decimalPlaces = options.bankRoundDecimalPlaces;
50177
+ const decimalPlaces = options.bankRoundDecimalPlaces ?? 2;
50178
50178
  processedValue = fBankRound(processedValue, decimalPlaces);
50179
50179
  }
50180
+ if (options == null ? void 0 : options.returnNumber) {
50181
+ if (options.maximumFractionDigits !== void 0 || options.minimumFractionDigits !== void 0) {
50182
+ const min = options.minimumFractionDigits ?? 0;
50183
+ const max = options.maximumFractionDigits ?? 20;
50184
+ processedValue = Number(processedValue.toLocaleString("en-US", {
50185
+ minimumFractionDigits: min,
50186
+ maximumFractionDigits: max,
50187
+ useGrouping: false
50188
+ }));
50189
+ }
50190
+ return processedValue;
50191
+ }
50180
50192
  const formatOptions = {};
50181
50193
  if ((options == null ? void 0 : options.maximumFractionDigits) !== void 0) {
50182
50194
  formatOptions.maximumFractionDigits = options.maximumFractionDigits;
@@ -50186,6 +50198,37 @@ const fFormatRuNumber = (a, options) => {
50186
50198
  }
50187
50199
  return new Intl.NumberFormat("ru-RU", formatOptions).format(processedValue);
50188
50200
  };
50201
+ function fConvertDate(input, options = { format: "iso" }) {
50202
+ const format = options.format ?? "iso";
50203
+ const locale = 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.customOptions).format(date);
50228
+ default:
50229
+ return "";
50230
+ }
50231
+ }
50189
50232
  function bind(fn, thisArg) {
50190
50233
  return function wrap() {
50191
50234
  return fn.apply(thisArg, arguments);
@@ -52686,6 +52729,7 @@ export {
52686
52729
  fAlert,
52687
52730
  fBankRound,
52688
52731
  fConfirm,
52732
+ fConvertDate,
52689
52733
  fConvertFileToBase64,
52690
52734
  fDownloadBlobFile,
52691
52735
  fDownloadFileFromBase64,