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

123456789101112131415161718192021
  1. import { FORMAT_DEFAULT } from '../../constant';
  2. export default (function (o, c) {
  3. // locale needed later
  4. var proto = c.prototype;
  5. var oldFormat = proto.format; // extend en locale here
  6. proto.format = function (formatStr) {
  7. var _this = this;
  8. var yearBias = 543;
  9. var str = formatStr || FORMAT_DEFAULT;
  10. var result = str.replace(/(\[[^\]]+])|BBBB|BB/g, function (match, a) {
  11. var _this$$utils;
  12. var year = String(_this.$y + yearBias);
  13. var args = match === 'BB' ? [year.slice(-2), 2] : [year, 4];
  14. return a || (_this$$utils = _this.$utils()).s.apply(_this$$utils, args.concat(['0']));
  15. });
  16. return oldFormat.bind(this)(result);
  17. };
  18. });