2e5fe9d938a3f2560b63c8f583357779.json
15.3 KB
{"ast":null,"code":"import moment from 'moment';\nimport { noteOnce } from \"rc-util/es/warning\";\nvar generateConfig = {\n // get\n getNow: function getNow() {\n return moment();\n },\n getFixedDate: function getFixedDate(string) {\n return moment(string, 'YYYY-MM-DD');\n },\n getEndDate: function getEndDate(date) {\n var clone = date.clone();\n return clone.endOf('month');\n },\n getWeekDay: function getWeekDay(date) {\n var clone = date.clone().locale('en_US');\n return clone.weekday() + clone.localeData().firstDayOfWeek();\n },\n getYear: function getYear(date) {\n return date.year();\n },\n getMonth: function getMonth(date) {\n return date.month();\n },\n getDate: function getDate(date) {\n return date.date();\n },\n getHour: function getHour(date) {\n return date.hour();\n },\n getMinute: function getMinute(date) {\n return date.minute();\n },\n getSecond: function getSecond(date) {\n return date.second();\n },\n // set\n addYear: function addYear(date, diff) {\n var clone = date.clone();\n return clone.add(diff, 'year');\n },\n addMonth: function addMonth(date, diff) {\n var clone = date.clone();\n return clone.add(diff, 'month');\n },\n addDate: function addDate(date, diff) {\n var clone = date.clone();\n return clone.add(diff, 'day');\n },\n setYear: function setYear(date, year) {\n var clone = date.clone();\n return clone.year(year);\n },\n setMonth: function setMonth(date, month) {\n var clone = date.clone();\n return clone.month(month);\n },\n setDate: function setDate(date, num) {\n var clone = date.clone();\n return clone.date(num);\n },\n setHour: function setHour(date, hour) {\n var clone = date.clone();\n return clone.hour(hour);\n },\n setMinute: function setMinute(date, minute) {\n var clone = date.clone();\n return clone.minute(minute);\n },\n setSecond: function setSecond(date, second) {\n var clone = date.clone();\n return clone.second(second);\n },\n // Compare\n isAfter: function isAfter(date1, date2) {\n return date1.isAfter(date2);\n },\n isValidate: function isValidate(date) {\n return date.isValid();\n },\n locale: {\n getWeekFirstDay: function getWeekFirstDay(locale) {\n var date = moment().locale(locale);\n return date.localeData().firstDayOfWeek();\n },\n getWeekFirstDate: function getWeekFirstDate(locale, date) {\n var clone = date.clone();\n var result = clone.locale(locale);\n return result.weekday(0);\n },\n getWeek: function getWeek(locale, date) {\n var clone = date.clone();\n var result = clone.locale(locale);\n return result.week();\n },\n getShortWeekDays: function getShortWeekDays(locale) {\n var date = moment().locale(locale);\n return date.localeData().weekdaysMin();\n },\n getShortMonths: function getShortMonths(locale) {\n var date = moment().locale(locale);\n return date.localeData().monthsShort();\n },\n format: function format(locale, date, _format) {\n var clone = date.clone();\n var result = clone.locale(locale);\n return result.format(_format);\n },\n parse: function parse(locale, text, formats) {\n var fallbackFormatList = [];\n\n for (var i = 0; i < formats.length; i += 1) {\n var format = formats[i];\n var formatText = text;\n\n if (format.includes('wo') || format.includes('Wo')) {\n format = format.replace(/wo/g, 'w').replace(/Wo/g, 'W');\n var matchFormat = format.match(/[-YyMmDdHhSsWwGg]+/g);\n var matchText = formatText.match(/[-\\d]+/g);\n\n if (matchFormat && matchText) {\n format = matchFormat.join('');\n formatText = matchText.join('');\n } else {\n fallbackFormatList.push(format.replace(/o/g, ''));\n }\n }\n\n var date = moment(formatText, format, locale, true);\n\n if (date.isValid()) {\n return date;\n }\n } // Fallback to fuzzy matching, this should always not reach match or need fire a issue\n\n\n for (var _i = 0; _i < fallbackFormatList.length; _i += 1) {\n var _date = moment(text, fallbackFormatList[_i], locale, false);\n /* istanbul ignore next */\n\n\n if (_date.isValid()) {\n noteOnce(false, 'Not match any format strictly and fallback to fuzzy match. Please help to fire a issue about this.');\n return _date;\n }\n }\n\n return null;\n }\n }\n};\nexport default generateConfig;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/rc-picker/es/generate/moment.js"],"names":["moment","noteOnce","generateConfig","getNow","getFixedDate","string","getEndDate","date","clone","endOf","getWeekDay","locale","weekday","localeData","firstDayOfWeek","getYear","year","getMonth","month","getDate","getHour","hour","getMinute","minute","getSecond","second","addYear","diff","add","addMonth","addDate","setYear","setMonth","setDate","num","setHour","setMinute","setSecond","isAfter","date1","date2","isValidate","isValid","getWeekFirstDay","getWeekFirstDate","result","getWeek","week","getShortWeekDays","weekdaysMin","getShortMonths","monthsShort","format","_format","parse","text","formats","fallbackFormatList","i","length","formatText","includes","replace","matchFormat","match","matchText","join","push","_i","_date"],"mappings":"AAAA,OAAOA,MAAP,MAAmB,QAAnB;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,IAAIC,cAAc,GAAG;AACnB;AACAC,EAAAA,MAAM,EAAE,SAASA,MAAT,GAAkB;AACxB,WAAOH,MAAM,EAAb;AACD,GAJkB;AAKnBI,EAAAA,YAAY,EAAE,SAASA,YAAT,CAAsBC,MAAtB,EAA8B;AAC1C,WAAOL,MAAM,CAACK,MAAD,EAAS,YAAT,CAAb;AACD,GAPkB;AAQnBC,EAAAA,UAAU,EAAE,SAASA,UAAT,CAAoBC,IAApB,EAA0B;AACpC,QAAIC,KAAK,GAAGD,IAAI,CAACC,KAAL,EAAZ;AACA,WAAOA,KAAK,CAACC,KAAN,CAAY,OAAZ,CAAP;AACD,GAXkB;AAYnBC,EAAAA,UAAU,EAAE,SAASA,UAAT,CAAoBH,IAApB,EAA0B;AACpC,QAAIC,KAAK,GAAGD,IAAI,CAACC,KAAL,GAAaG,MAAb,CAAoB,OAApB,CAAZ;AACA,WAAOH,KAAK,CAACI,OAAN,KAAkBJ,KAAK,CAACK,UAAN,GAAmBC,cAAnB,EAAzB;AACD,GAfkB;AAgBnBC,EAAAA,OAAO,EAAE,SAASA,OAAT,CAAiBR,IAAjB,EAAuB;AAC9B,WAAOA,IAAI,CAACS,IAAL,EAAP;AACD,GAlBkB;AAmBnBC,EAAAA,QAAQ,EAAE,SAASA,QAAT,CAAkBV,IAAlB,EAAwB;AAChC,WAAOA,IAAI,CAACW,KAAL,EAAP;AACD,GArBkB;AAsBnBC,EAAAA,OAAO,EAAE,SAASA,OAAT,CAAiBZ,IAAjB,EAAuB;AAC9B,WAAOA,IAAI,CAACA,IAAL,EAAP;AACD,GAxBkB;AAyBnBa,EAAAA,OAAO,EAAE,SAASA,OAAT,CAAiBb,IAAjB,EAAuB;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P;AACD;AACF,OAzB0C,CAyBzC;;;AAGF,WAAK,IAAI6D,EAAE,GAAG,CAAd,EAAiBA,EAAE,GAAGX,kBAAkB,CAACE,MAAzC,EAAiDS,EAAE,IAAI,CAAvD,EAA0D;AACxD,YAAIC,KAAK,GAAGrE,MAAM,CAACuD,IAAD,EAAOE,kBAAkB,CAACW,EAAD,CAAzB,EAA+BzD,MAA/B,EAAuC,KAAvC,CAAlB;AACA;;;AAGA,YAAI0D,KAAK,CAAC3B,OAAN,EAAJ,EAAqB;AACnBzC,UAAAA,QAAQ,CAAC,KAAD,EAAQ,oGAAR,CAAR;AACA,iBAAOoE,KAAP;AACD;AACF;;AAED,aAAO,IAAP;AACD;AApEK;AA9EW,CAArB;AAqJA,eAAenE,cAAf","sourcesContent":["import moment from 'moment';\nimport { noteOnce } from \"rc-util/es/warning\";\nvar generateConfig = {\n // get\n getNow: function getNow() {\n return moment();\n },\n getFixedDate: function getFixedDate(string) {\n return moment(string, 'YYYY-MM-DD');\n },\n getEndDate: function getEndDate(date) {\n var clone = date.clone();\n return clone.endOf('month');\n },\n getWeekDay: function getWeekDay(date) {\n var clone = date.clone().locale('en_US');\n return clone.weekday() + clone.localeData().firstDayOfWeek();\n },\n getYear: function getYear(date) {\n return date.year();\n },\n getMonth: function getMonth(date) {\n return date.month();\n },\n getDate: function getDate(date) {\n return date.date();\n },\n getHour: function getHour(date) {\n return date.hour();\n },\n getMinute: function getMinute(date) {\n return date.minute();\n },\n getSecond: function getSecond(date) {\n return date.second();\n },\n // set\n addYear: function addYear(date, diff) {\n var clone = date.clone();\n return clone.add(diff, 'year');\n },\n addMonth: function addMonth(date, diff) {\n var clone = date.clone();\n return clone.add(diff, 'month');\n },\n addDate: function addDate(date, diff) {\n var clone = date.clone();\n return clone.add(diff, 'day');\n },\n setYear: function setYear(date, year) {\n var clone = date.clone();\n return clone.year(year);\n },\n setMonth: function setMonth(date, month) {\n var clone = date.clone();\n return clone.month(month);\n },\n setDate: function setDate(date, num) {\n var clone = date.clone();\n return clone.date(num);\n },\n setHour: function setHour(date, hour) {\n var clone = date.clone();\n return clone.hour(hour);\n },\n setMinute: function setMinute(date, minute) {\n var clone = date.clone();\n return clone.minute(minute);\n },\n setSecond: function setSecond(date, second) {\n var clone = date.clone();\n return clone.second(second);\n },\n // Compare\n isAfter: function isAfter(date1, date2) {\n return date1.isAfter(date2);\n },\n isValidate: function isValidate(date) {\n return date.isValid();\n },\n locale: {\n getWeekFirstDay: function getWeekFirstDay(locale) {\n var date = moment().locale(locale);\n return date.localeData().firstDayOfWeek();\n },\n getWeekFirstDate: function getWeekFirstDate(locale, date) {\n var clone = date.clone();\n var result = clone.locale(locale);\n return result.weekday(0);\n },\n getWeek: function getWeek(locale, date) {\n var clone = date.clone();\n var result = clone.locale(locale);\n return result.week();\n },\n getShortWeekDays: function getShortWeekDays(locale) {\n var date = moment().locale(locale);\n return date.localeData().weekdaysMin();\n },\n getShortMonths: function getShortMonths(locale) {\n var date = moment().locale(locale);\n return date.localeData().monthsShort();\n },\n format: function format(locale, date, _format) {\n var clone = date.clone();\n var result = clone.locale(locale);\n return result.format(_format);\n },\n parse: function parse(locale, text, formats) {\n var fallbackFormatList = [];\n\n for (var i = 0; i < formats.length; i += 1) {\n var format = formats[i];\n var formatText = text;\n\n if (format.includes('wo') || format.includes('Wo')) {\n format = format.replace(/wo/g, 'w').replace(/Wo/g, 'W');\n var matchFormat = format.match(/[-YyMmDdHhSsWwGg]+/g);\n var matchText = formatText.match(/[-\\d]+/g);\n\n if (matchFormat && matchText) {\n format = matchFormat.join('');\n formatText = matchText.join('');\n } else {\n fallbackFormatList.push(format.replace(/o/g, ''));\n }\n }\n\n var date = moment(formatText, format, locale, true);\n\n if (date.isValid()) {\n return date;\n }\n } // Fallback to fuzzy matching, this should always not reach match or need fire a issue\n\n\n for (var _i = 0; _i < fallbackFormatList.length; _i += 1) {\n var _date = moment(text, fallbackFormatList[_i], locale, false);\n /* istanbul ignore next */\n\n\n if (_date.isValid()) {\n noteOnce(false, 'Not match any format strictly and fallback to fuzzy match. Please help to fire a issue about this.');\n return _date;\n }\n }\n\n return null;\n }\n }\n};\nexport default generateConfig;"]},"metadata":{},"sourceType":"module"}