89ed3d3859ab3f0d3f4663c1a37d8d68140e7751829b951d7155c8606a5a459b7d612f1aedc3c403f3b3c8d8ec475eefa52783957f6757345e1c14fa08f5d4 686 B

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. });