Node-Red configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* eslint-disable no-console */
  2. export default (function (o, c, d) {
  3. /* istanbul ignore next line */
  4. if (!process || process.env.NODE_ENV !== 'production') {
  5. var proto = c.prototype;
  6. var oldParse = proto.parse;
  7. proto.parse = function (cfg) {
  8. var date = cfg.date;
  9. if (typeof date === 'string' && date.length === 13) {
  10. 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");
  11. }
  12. if (typeof date === 'number' && String(date).length === 4) {
  13. 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");
  14. }
  15. if (cfg.args.length >= 2 && !d.p.customParseFormat) {
  16. 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");
  17. }
  18. return oldParse.bind(this)(cfg);
  19. };
  20. var oldLocale = d.locale;
  21. d.locale = function (preset, object, isLocal) {
  22. if (typeof object === 'undefined' && typeof preset === 'string') {
  23. if (!d.Ls[preset]) {
  24. 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");
  25. }
  26. }
  27. return oldLocale(preset, object, isLocal);
  28. };
  29. }
  30. });