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 681B

123456789101112131415161718192021222324252627282930313233
  1. export default (function (o, c, dayjs) {
  2. var proto = c.prototype;
  3. var parseDate = function parseDate(cfg) {
  4. var date = cfg.date,
  5. utc = cfg.utc;
  6. if (Array.isArray(date)) {
  7. if (utc) {
  8. if (!date.length) {
  9. return new Date();
  10. }
  11. return new Date(Date.UTC.apply(null, date));
  12. }
  13. if (date.length === 1) {
  14. return dayjs(String(date[0])).toDate();
  15. }
  16. return new (Function.prototype.bind.apply(Date, [null].concat(date)))();
  17. }
  18. return date;
  19. };
  20. var oldParse = proto.parse;
  21. proto.parse = function (cfg) {
  22. cfg.date = parseDate.bind(this)(cfg);
  23. oldParse.bind(this)(cfg);
  24. };
  25. });