{"version":3,"sources":["components/moment.js","formatters/moment.js"],"names":["dmx","Component","initialData","locale","attributes","type","String","default","methods","setLocale","this","_setLocale","init","moment","dmxComponent","props","performUpdate","updatedProps","has","window","navigator","language","set","_component","_now","format","_today","_moment","dt","undefined","document","querySelector","parse","Formatters","momentIsValid","date","isValid","momentMin","dates","min","momentMax","max","momentAdd","num","key","add","momentSubtract","subtract","momentFormat","momentFromNow","noSuffix","fromNow","momentFrom","date2","from","momentToNow","toNow","momentTo","to","momentCalendar","referenceDay","calendar","momentDiff","float","diff","momentDaysInMonth","daysInMonth","momentToObject","toObject","momentIsBefore","isBefore","momentIsSame","isSame","momentIsAfter","isAfter","momentIsSameOrBefore","isSameOrBefore","momentIsSameOrAfter","isSameOrAfter","momentIsBetween","date1","isBetween","momentIsLeapYear","isLeapYear"],"mappings":";;;;;;AAAAA,IAAAC,UAAA,SAAA,CAEAC,YAAA,CACAC,OAAA,MAGAC,WAAA,CACAD,OAAA,CACAE,KAAAC,OACAC,QAAA,OAIAC,QAAA,CACAC,UAAAN,GACAO,KAAAC,WAAAR,EACA,GAGAS,OACAC,OAAAC,aAAAJ,KACAA,KAAAC,WAAAD,KAAAK,MAAAZ,OACA,EAEAa,cAAAC,GACAA,EAAAC,IAAA,WACAR,KAAAC,WAAAD,KAAAK,MAAAZ,OAEA,EAEAQ,WAAAR,GACAU,OAAAV,OAAA,QAAAA,EAAAgB,OAAAC,UAAAC,SAAAlB,GACAO,KAAAY,IAAA,SAAAT,OAAAV,SACA,ICjCA,MAEA,IAAAoB,EACA,MAAAC,EAAAX,SAAAY,OAAA,2BACAC,EAAAb,SAAAY,OAAA,cACAE,EAAAC,SAEAC,IAAAN,IAAAA,EAAAO,SAAAC,cAAA,kCAEAR,GAAAvB,IAAAgC,MAAA,SAAAT,EAAAT,cACA,OAAAc,IAAAA,EAAAJ,GACA,SAAAI,IAAAA,EAAAF,GACAb,OAAAe,IAGA5B,IAAAiC,WAAA,SAAA,CAEAC,cAAAC,GACAR,EA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Q,GAAA2C,cAAAzB,EAAAT,GAGAmC,gBAAA,CAAA5C,EAAA6C,EAAA3B,EAAAT,IACAjB,EAAAQ,GAAA8C,UAAAD,EAAA3B,EAAAT,GAGAsC,iBAAA/C,GACAR,EAAAQ,GAAAgD,cAKA,EAvGA","file":"dmxMoment.js","sourcesContent":["dmx.Component('moment', {\r\n\r\n initialData: {\r\n locale: 'en',\r\n },\r\n\r\n attributes: {\r\n locale: {\r\n type: String,\r\n default: 'en',\r\n },\r\n },\r\n\r\n methods: {\r\n setLocale (locale) {\r\n this._setLocale(locale);\r\n },\r\n },\r\n\r\n init () {\r\n moment.dmxComponent = this;\r\n this._setLocale(this.props.locale);\r\n },\r\n\r\n performUpdate (updatedProps) {\r\n if (updatedProps.has('locale')) {\r\n this._setLocale(this.props.locale);\r\n }\r\n },\r\n\r\n _setLocale (locale) {\r\n moment.locale(locale == 'auto' ? window.navigator.language : locale);\r\n this.set('locale', moment.locale());\r\n },\r\n\r\n});\r\n","(() => {\r\n\r\nlet _component;\r\nconst _now = moment().format('YYYY-MM-DD HH:mm:ss.SSS');\r\nconst _today = moment().format('YYYY-MM-DD');\r\nconst _moment = (dt) => {\r\n // search for moment component\r\n if (_component === undefined) _component = document.querySelector('dmx-moment, [is=\"dmx-moment\"]');\r\n // parse locale from moment component, this will register the current expression for changes\r\n if (_component) dmx.parse('locale', _component.dmxComponent);\r\n if (dt == 'now') dt = _now;\r\n if (dt == 'today') dt = _today;\r\n return moment(dt);\r\n};\r\n\r\ndmx.Formatters('string', {\r\n\r\n momentIsValid (date) {\r\n return _moment(date).isValid();\r\n },\r\n\r\n momentMin (...dates) {\r\n return moment.min(...dates).format('YYYY-MM-DD HH:mm:ss.SSS');\r\n },\r\n\r\n momentMax (...dates) {\r\n return moment.max(...dates).format('YYYY-MM-DD HH:mm:ss.SSS');\r\n },\r\n\r\n momentAdd (date, num, key) {\r\n return _moment(date).add(num, key).format('YYYY-MM-DD HH:mm:ss.SSS');\r\n },\r\n\r\n momentSubtract (date, num, key) {\r\n return _moment(date).subtract(num, key).format('YYYY-MM-DD HH:mm:ss.SSS');\r\n },\r\n\r\n momentFormat (date, format) {\r\n return _moment(date).format(format);\r\n },\r\n\r\n momentFromNow (date, noSuffix) {\r\n return _moment(date).fromNow(noSuffix);\r\n },\r\n\r\n momentFrom (date, date2, noSuffix) {\r\n return _moment(date).from(date2, noSuffix);\r\n },\r\n\r\n momentToNow (date, noSuffix) {\r\n return _moment(date).toNow(noSuffix);\r\n },\r\n\r\n momentTo (date, date2, noSuffix) {\r\n return _moment(date).to(date2, noSuffix);\r\n },\r\n\r\n momentCalendar (date, referenceDay) {\r\n return _moment(date).calendar(referenceDay);\r\n },\r\n\r\n momentDiff (date, date2, key, float) {\r\n return _moment(date).diff(date2, key, float);\r\n },\r\n\r\n momentDaysInMonth (date) {\r\n return _moment(date).daysInMonth();\r\n },\r\n\r\n momentToObject (date) {\r\n return _moment(date).toObject();\r\n },\r\n\r\n momentIsBefore (date, date2, key) {\r\n return _moment(date).isBefore(date2, key);\r\n },\r\n\r\n momentIsSame (date, date2, key) {\r\n return _moment(date).isSame(date2, key);\r\n },\r\n\r\n momentIsAfter (date, date2, key) {\r\n return _moment(date).isAfter(date2, key);\r\n },\r\n\r\n momentIsSameOrBefore (date, date2, key) {\r\n return _moment(date).isSameOrBefore(date2, key);\r\n },\r\n\r\n momentIsSameOrAfter (date, date2, key) {\r\n return _moment(date).isSameOrAfter(date2, key);\r\n },\r\n\r\n momentIsBetween (date, date1, date2, key) {\r\n return _moment(date).isBetween(date1, date2, key);\r\n },\r\n\r\n momentIsLeapYear (date) {\r\n return _moment(date).isLeapYear();\r\n },\r\n\r\n});\r\n\r\n})();"]}