1 |
|
2 | export default (function (o, c, d) {
|
3 | if (!process || process.env.NODE_ENV !== 'production') {
|
4 | var proto = c.prototype;
|
5 | var oldParse = proto.parse;
|
6 |
|
7 | proto.parse = function (cfg) {
|
8 | var date = cfg.date;
|
9 |
|
10 | if (typeof date === 'string' && date.length === 13) {
|
11 | console.warn("To parse a Unix timestamp like " + date + ", you should pass it as a Number. https://day.js.org/docs/en/parse/unix-timestamp-milliseconds");
|
12 | }
|
13 |
|
14 | if (typeof date === 'number' && String(date).length === 4) {
|
15 | console.warn("Guessing you may want to parse the Year " + date + ", you should pass it as a String " + date + ", not a Number. Otherwise, " + date + " will be treated as a Unix timestamp");
|
16 | }
|
17 |
|
18 | if (cfg.args.length >= 2 && !d.p.customParseFormat) {
|
19 | console.warn("To parse a date-time string like " + date + " using the given format, you should enable customParseFormat plugin first. https://day.js.org/docs/en/parse/string-format");
|
20 | }
|
21 |
|
22 | return oldParse.bind(this)(cfg);
|
23 | };
|
24 |
|
25 | var oldLocale = d.locale;
|
26 |
|
27 | d.locale = function (preset, object, isLocal) {
|
28 | if (typeof object === 'undefined' && typeof preset === 'string') {
|
29 | if (!d.Ls[preset]) {
|
30 | console.warn("Guessing you may want to use locale " + preset + ", you have to load it before using it. https://day.js.org/docs/en/i18n/loading-into-nodejs");
|
31 | }
|
32 | }
|
33 |
|
34 | return oldLocale(preset, object, isLocal);
|
35 | };
|
36 | }
|
37 | }); |
\ | No newline at end of file |