UNPKG

ivue-material-plus

Version:

A high quality UI components Library with Vue.js

26 lines (21 loc) 884 B
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var pad = require('./pad.js'); 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["default"](month || 1), pad["default"](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; } }; exports["default"] = CreateNativeLocaleFormatter; //# sourceMappingURL=create-native-locale-formatter.js.map