ivue-material-plus
Version:
A high quality UI components Library with Vue.js
22 lines (19 loc) • 783 B
JavaScript
import Pad from './pad.mjs';
var CreateNativeLocaleFormatter = (locale, options, { start, length } = { start: 0, length: 0 }) => {
const makeIsoString = (dateString) => {
const [year, month, date] = dateString.trim().split(" ")[0].split("-");
return [year, Pad(month || 1), Pad(date || 1)].join("-");
};
try {
const intlFormatter = new Intl.DateTimeFormat(locale || void 0, options);
return (dateString) => {
return intlFormatter.format(
new Date(`${makeIsoString(dateString)}T00:00:00+00:00`)
);
};
} catch (e) {
return start || length ? (dateString) => makeIsoString(dateString).substr(start, length) : null;
}
};
export { CreateNativeLocaleFormatter as default };
//# sourceMappingURL=create-native-locale-formatter.mjs.map