Files
ETB/ETB-FrontEnd/node_modules/@mui/x-date-pickers/node/AdapterDayjs/index.js
Iliyan Angelov 306b20e24a Frontend start
2025-09-14 00:54:48 +03:00

58 lines
1.4 KiB
JavaScript

"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.AdapterDayjs = void 0;
var _dayjs = _interopRequireDefault(require("@date-io/dayjs"));
const formatTokenMap = {
YY: 'year',
YYYY: 'year',
M: 'month',
MM: 'month',
MMM: 'month',
MMMM: 'month',
D: 'day',
DD: 'day',
H: 'hour',
HH: 'hour',
h: 'hour',
hh: 'hour',
m: 'minute',
mm: 'minute',
s: 'second',
ss: 'second',
A: 'am-pm',
a: 'am-pm'
};
class AdapterDayjs extends _dayjs.default {
constructor(...args) {
super(...args);
this.formatTokenMap = formatTokenMap;
this.expandFormat = format => {
var _this$rawDayJsInstanc;
const localeFormats = (_this$rawDayJsInstanc = this.rawDayJsInstance.Ls[this.locale || 'en']) == null ? void 0 : _this$rawDayJsInstanc.formats; // @see https://github.com/iamkun/dayjs/blob/dev/src/plugin/localizedFormat/index.js
const t = formatBis => formatBis.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (_, a, b) => a || b.slice(1));
return format.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (_, a, b) => {
const B = b && b.toUpperCase();
return a || localeFormats[b] || t(localeFormats[B]);
});
};
this.getFormatHelperText = format => {
return this.expandFormat(format).replace(/a/gi, '(a|p)m').toLocaleLowerCase();
};
}
}
exports.AdapterDayjs = AdapterDayjs;