@internetarchive/histogram-date-range 1.3.0 → 1.3.1-alpha-webdev7745.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,GAEnB,MAAM,4BAA4B,CAAC","sourcesContent":["export {\r\n HistogramDateRange,\r\n BinSnappingInterval,\r\n} from './src/histogram-date-range';\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,GAEnB,MAAM,4BAA4B,CAAC","sourcesContent":["export {\n HistogramDateRange,\n BinSnappingInterval,\n} from './src/histogram-date-range';\n"]}
@@ -0,0 +1,2 @@
1
+ import dayjs from 'dayjs/esm';
2
+ export declare function fixFirstCenturyYears(_: unknown, cls: typeof dayjs.Dayjs): void;
@@ -0,0 +1,25 @@
1
+ export function fixFirstCenturyYears(_, cls) {
2
+ const proto = cls.prototype;
3
+ const oldParse = proto.parse;
4
+ proto.parse = function (cfg) {
5
+ this.__lastDate = cfg === null || cfg === void 0 ? void 0 : cfg.date;
6
+ this.__lastFormat = cfg === null || cfg === void 0 ? void 0 : cfg.args[1];
7
+ oldParse.call(this, cfg);
8
+ const isProblemDateRange = this.$y >= 1900 && this.$y < 2000;
9
+ const isProblemStringFormat = typeof this.__lastFormat === 'string' &&
10
+ this.__lastFormat.includes('YYYY');
11
+ const isProblemArrayFormat = Array.isArray(this.__lastFormat) &&
12
+ typeof this.__lastFormat[1] === 'string' &&
13
+ this.__lastFormat[1].includes('YYYY');
14
+ const isProblemFormat = isProblemStringFormat || isProblemArrayFormat;
15
+ const missingParsedYear = typeof this.__lastDate === 'string' &&
16
+ !this.__lastDate.includes(`${this.$y}`);
17
+ if (isProblemDateRange && isProblemFormat && missingParsedYear) {
18
+ const old = new Date(this.$d);
19
+ this.$d.setFullYear(this.$y - 1900);
20
+ this.init();
21
+ console.log('fixed year', this.__lastDate, this.__lastFormat, old, this.$d);
22
+ }
23
+ };
24
+ }
25
+ //# sourceMappingURL=fix-first-century-years.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fix-first-century-years.js","sourceRoot":"","sources":["../../../src/dayjs/fix-first-century-years.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,oBAAoB,CAAC,CAAU,EAAE,GAAuB;IACtE,MAAM,KAAK,GAAG,GAAG,CAAC,SAAS,CAAC;IAC5B,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC;IAC7B,KAAK,CAAC,KAAK,GAAG,UAAU,GAAG;QACzB,IAAI,CAAC,UAAU,GAAG,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,CAAC;QAC5B,IAAI,CAAC,YAAY,GAAG,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,CAAC,CAAC,CAAC,CAAC;QACjC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAEzB,MAAM,kBAAkB,GAAG,IAAI,CAAC,EAAE,IAAI,IAAI,IAAI,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC;QAC7D,MAAM,qBAAqB,GACzB,OAAO,IAAI,CAAC,YAAY,KAAK,QAAQ;YACrC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACrC,MAAM,oBAAoB,GACxB,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC;YAChC,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,QAAQ;YACxC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACxC,MAAM,eAAe,GAAG,qBAAqB,IAAI,oBAAoB,CAAC;QACtE,MAAM,iBAAiB,GACrB,OAAO,IAAI,CAAC,UAAU,KAAK,QAAQ;YACnC,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;QAE1C,IAAI,kBAAkB,IAAI,eAAe,IAAI,iBAAiB,EAAE;YAC9D,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAC9B,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;YACpC,IAAI,CAAC,IAAI,EAAE,CAAC;YACZ,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,YAAY,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;SAC7E;IACH,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import dayjs from 'dayjs/esm';\n\nexport function fixFirstCenturyYears(_: unknown, cls: typeof dayjs.Dayjs) {\n const proto = cls.prototype;\n const oldParse = proto.parse;\n proto.parse = function (cfg) {\n this.__lastDate = cfg?.date;\n this.__lastFormat = cfg?.args[1];\n oldParse.call(this, cfg);\n\n const isProblemDateRange = this.$y >= 1900 && this.$y < 2000;\n const isProblemStringFormat =\n typeof this.__lastFormat === 'string' &&\n this.__lastFormat.includes('YYYY');\n const isProblemArrayFormat =\n Array.isArray(this.__lastFormat) &&\n typeof this.__lastFormat[1] === 'string' &&\n this.__lastFormat[1].includes('YYYY');\n const isProblemFormat = isProblemStringFormat || isProblemArrayFormat;\n const missingParsedYear = \n typeof this.__lastDate === 'string' &&\n !this.__lastDate.includes(`${this.$y}`);\n \n if (isProblemDateRange && isProblemFormat && missingParsedYear) {\n const old = new Date(this.$d);\n this.$d.setFullYear(this.$y - 1900);\n this.init();\n console.log('fixed year', this.__lastDate, this.__lastFormat, old, this.$d);\n }\n };\n}"]}
@@ -0,0 +1,2 @@
1
+ import dayjs from 'dayjs/esm';
2
+ export declare function fixFirstCenturyYears(_: unknown, cls: typeof dayjs.Dayjs): void;
@@ -0,0 +1,25 @@
1
+ export function fixFirstCenturyYears(_, cls) {
2
+ const proto = cls.prototype;
3
+ const oldParse = proto.parse;
4
+ proto.parse = function (cfg) {
5
+ this.__lastDate = cfg === null || cfg === void 0 ? void 0 : cfg.date;
6
+ this.__lastFormat = cfg === null || cfg === void 0 ? void 0 : cfg.args[1];
7
+ oldParse.call(this, cfg);
8
+ const isProblemDateRange = this.$y >= 1900 && this.$y < 2000;
9
+ const isProblemStringFormat = typeof this.__lastFormat === 'string' &&
10
+ this.__lastFormat.includes('YYYY');
11
+ const isProblemArrayFormat = Array.isArray(this.__lastFormat) &&
12
+ typeof this.__lastFormat[1] === 'string' &&
13
+ this.__lastFormat[1].includes('YYYY');
14
+ const isProblemFormat = isProblemStringFormat || isProblemArrayFormat;
15
+ const missingParsedYear = typeof this.__lastDate === 'string' &&
16
+ !this.__lastDate.includes(`${this.$y}`);
17
+ if (isProblemDateRange && isProblemFormat && missingParsedYear) {
18
+ const old = new Date(this.$d);
19
+ this.$d.setFullYear(this.$y - 1900);
20
+ this.init();
21
+ console.log('fixed year', this.__lastDate, this.__lastFormat, old, this.$d);
22
+ }
23
+ };
24
+ }
25
+ //# sourceMappingURL=fix-two-digit-dates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fix-two-digit-dates.js","sourceRoot":"","sources":["../../../src/dayjs/fix-two-digit-dates.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,oBAAoB,CAAC,CAAU,EAAE,GAAuB;IACtE,MAAM,KAAK,GAAG,GAAG,CAAC,SAAS,CAAC;IAC5B,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC;IAC7B,KAAK,CAAC,KAAK,GAAG,UAAU,GAAG;QACzB,IAAI,CAAC,UAAU,GAAG,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,CAAC;QAC5B,IAAI,CAAC,YAAY,GAAG,GAAG,aAAH,GAAG,uBAAH,GA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eof dayjs.Dayjs) {\n const proto = cls.prototype;\n const oldParse = proto.parse;\n proto.parse = function (cfg) {\n this.__lastDate = cfg?.date;\n this.__lastFormat = cfg?.args[1];\n oldParse.call(this, cfg);\n\n const isProblemDateRange = this.$y >= 1900 && this.$y < 2000;\n const isProblemStringFormat =\n typeof this.__lastFormat === 'string' &&\n this.__lastFormat.includes('YYYY');\n const isProblemArrayFormat =\n Array.isArray(this.__lastFormat) &&\n typeof this.__lastFormat[1] === 'string' &&\n this.__lastFormat[1].includes('YYYY');\n const isProblemFormat = isProblemStringFormat || isProblemArrayFormat;\n const missingParsedYear = \n typeof this.__lastDate === 'string' &&\n !this.__lastDate.includes(`${this.$y}`);\n \n if (isProblemDateRange && isProblemFormat && missingParsedYear) {\n const old = new Date(this.$d);\n this.$d.setFullYear(this.$y - 1900);\n this.init();\n console.log('fixed year', this.__lastDate, this.__lastFormat, old, this.$d);\n }\n };\n}"]}