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