chrono-node 2.7.4 → 2.7.6
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/cjs/common/parsers/AbstractTimeExpressionParser.js +11 -2
- package/dist/cjs/common/parsers/AbstractTimeExpressionParser.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/locales/de/index.d.ts +2 -2
- package/dist/cjs/locales/de/index.js.map +1 -1
- package/dist/cjs/locales/en/constants.js +3 -2
- package/dist/cjs/locales/en/constants.js.map +1 -1
- package/dist/cjs/locales/en/index.d.ts +2 -2
- package/dist/cjs/locales/en/index.js.map +1 -1
- package/dist/cjs/locales/en/parsers/ENMonthNameLittleEndianParser.js +1 -1
- package/dist/cjs/locales/en/parsers/ENMonthNameLittleEndianParser.js.map +1 -1
- package/dist/cjs/locales/en/parsers/ENMonthNameMiddleEndianParser.js +1 -1
- package/dist/cjs/locales/en/parsers/ENMonthNameMiddleEndianParser.js.map +1 -1
- package/dist/cjs/locales/en/parsers/ENTimeUnitLaterFormatParser.js +1 -1
- package/dist/cjs/locales/en/parsers/ENTimeUnitLaterFormatParser.js.map +1 -1
- package/dist/cjs/locales/en/refiners/ENMergeDateTimeRefiner.js +1 -1
- package/dist/cjs/locales/en/refiners/ENMergeDateTimeRefiner.js.map +1 -1
- package/dist/cjs/locales/es/index.d.ts +2 -2
- package/dist/cjs/locales/es/index.js.map +1 -1
- package/dist/cjs/locales/fr/index.d.ts +2 -2
- package/dist/cjs/locales/fr/index.js.map +1 -1
- package/dist/cjs/locales/ja/index.d.ts +2 -2
- package/dist/cjs/locales/ja/index.js.map +1 -1
- package/dist/cjs/locales/nl/index.d.ts +2 -2
- package/dist/cjs/locales/nl/index.js.map +1 -1
- package/dist/cjs/locales/pt/index.d.ts +2 -2
- package/dist/cjs/locales/pt/index.js.map +1 -1
- package/dist/cjs/locales/ru/index.d.ts +2 -2
- package/dist/cjs/locales/ru/index.js.map +1 -1
- package/dist/cjs/locales/uk/index.d.ts +2 -2
- package/dist/cjs/locales/uk/index.js.map +1 -1
- package/dist/cjs/locales/zh/hans/index.d.ts +2 -2
- package/dist/cjs/locales/zh/hans/index.js.map +1 -1
- package/dist/cjs/locales/zh/hant/index.d.ts +2 -2
- package/dist/cjs/locales/zh/hant/index.js.map +1 -1
- package/dist/cjs/locales/zh/index.d.ts +12 -1
- package/dist/cjs/locales/zh/index.js +65 -5
- package/dist/cjs/locales/zh/index.js.map +1 -1
- package/dist/cjs/utils/pattern.d.ts +1 -1
- package/dist/cjs/utils/pattern.js +2 -2
- package/dist/cjs/utils/pattern.js.map +1 -1
- package/dist/esm/common/parsers/AbstractTimeExpressionParser.js +11 -2
- package/dist/esm/common/parsers/AbstractTimeExpressionParser.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/locales/de/index.d.ts +2 -2
- package/dist/esm/locales/de/index.js.map +1 -1
- package/dist/esm/locales/en/constants.js +3 -2
- package/dist/esm/locales/en/constants.js.map +1 -1
- package/dist/esm/locales/en/index.d.ts +2 -2
- package/dist/esm/locales/en/index.js.map +1 -1
- package/dist/esm/locales/en/parsers/ENMonthNameLittleEndianParser.js +1 -1
- package/dist/esm/locales/en/parsers/ENMonthNameLittleEndianParser.js.map +1 -1
- package/dist/esm/locales/en/parsers/ENMonthNameMiddleEndianParser.js +1 -1
- package/dist/esm/locales/en/parsers/ENMonthNameMiddleEndianParser.js.map +1 -1
- package/dist/esm/locales/en/parsers/ENTimeUnitLaterFormatParser.js +1 -1
- package/dist/esm/locales/en/parsers/ENTimeUnitLaterFormatParser.js.map +1 -1
- package/dist/esm/locales/en/refiners/ENMergeDateTimeRefiner.js +1 -1
- package/dist/esm/locales/en/refiners/ENMergeDateTimeRefiner.js.map +1 -1
- package/dist/esm/locales/es/index.d.ts +2 -2
- package/dist/esm/locales/es/index.js.map +1 -1
- package/dist/esm/locales/fr/index.d.ts +2 -2
- package/dist/esm/locales/fr/index.js.map +1 -1
- package/dist/esm/locales/ja/index.d.ts +2 -2
- package/dist/esm/locales/ja/index.js.map +1 -1
- package/dist/esm/locales/nl/index.d.ts +2 -2
- package/dist/esm/locales/nl/index.js.map +1 -1
- package/dist/esm/locales/pt/index.d.ts +2 -2
- package/dist/esm/locales/pt/index.js.map +1 -1
- package/dist/esm/locales/ru/index.d.ts +2 -2
- package/dist/esm/locales/ru/index.js.map +1 -1
- package/dist/esm/locales/uk/index.d.ts +2 -2
- package/dist/esm/locales/uk/index.js.map +1 -1
- package/dist/esm/locales/zh/hans/index.d.ts +2 -2
- package/dist/esm/locales/zh/hans/index.js.map +1 -1
- package/dist/esm/locales/zh/hant/index.d.ts +2 -2
- package/dist/esm/locales/zh/hant/index.js.map +1 -1
- package/dist/esm/locales/zh/index.d.ts +12 -1
- package/dist/esm/locales/zh/index.js +53 -1
- package/dist/esm/locales/zh/index.js.map +1 -1
- package/dist/esm/utils/pattern.d.ts +1 -1
- package/dist/esm/utils/pattern.js +2 -2
- package/dist/esm/utils/pattern.js.map +1 -1
- package/package.json +1 -1
- package/src/common/parsers/AbstractTimeExpressionParser.ts +16 -2
- package/src/index.ts +1 -1
- package/src/locales/de/index.ts +2 -2
- package/src/locales/en/constants.ts +9 -2
- package/src/locales/en/index.ts +2 -2
- package/src/locales/en/parsers/ENMonthNameLittleEndianParser.ts +1 -1
- package/src/locales/en/parsers/ENMonthNameMiddleEndianParser.ts +5 -4
- package/src/locales/en/parsers/ENTimeUnitLaterFormatParser.ts +1 -4
- package/src/locales/en/refiners/ENMergeDateTimeRefiner.ts +1 -1
- package/src/locales/es/index.ts +2 -2
- package/src/locales/fr/index.ts +2 -2
- package/src/locales/ja/index.ts +2 -2
- package/src/locales/nl/index.ts +2 -2
- package/src/locales/pt/index.ts +2 -2
- package/src/locales/ru/index.ts +2 -2
- package/src/locales/uk/index.ts +2 -2
- package/src/locales/zh/hans/index.ts +2 -2
- package/src/locales/zh/hant/index.ts +2 -2
- package/src/locales/zh/index.ts +73 -1
- package/src/utils/pattern.ts +6 -2
- package/test/en/en_casual.test.ts +6 -0
- package/test/en/en_month.test.ts +6 -1
- package/test/en/en_month_name_middle_endian.test.ts +2 -0
- package/test/en/en_slash.test.ts +15 -0
- package/test/en/en_time_exp.test.ts +30 -0
- package/test/en/en_time_units_later.test.ts +12 -0
- package/test/en/en_time_units_within.test.ts +42 -0
- package/test/system_timezone.test.ts +11 -0
- package/test/zh/{zh_hans_casual.test.ts → hans/zh_hans_casual.test.ts} +2 -2
- package/test/zh/{zh_hans_date.test.ts → hans/zh_hans_date.test.ts} +2 -2
- package/test/zh/{zh_hans_deadline.test.ts → hans/zh_hans_deadline.test.ts} +2 -2
- package/test/zh/{zh_hans_time_exp.test.ts → hans/zh_hans_time_exp.test.ts} +16 -2
- package/test/zh/{zh_hans_weekday.test.ts → hans/zh_hans_weekday.test.ts} +2 -2
- package/test/zh/{zh_hant_casual.test.ts → hant/zh_hant_casual.test.ts} +2 -2
- package/test/zh/{zh_hant_date.test.ts → hant/zh_hant_date.test.ts} +2 -2
- package/test/zh/{zh_hant_deadline.test.ts → hant/zh_hant_deadline.test.ts} +2 -2
- package/test/zh/{zh_hant_time_exp.test.ts → hant/zh_hant_time_exp.test.ts} +2 -2
- package/test/zh/{zh_hant_weekday.test.ts → hant/zh_hant_weekday.test.ts} +2 -2
- package/test/zh/zh.test.ts +18 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as chrono from "
|
|
2
|
-
import { testSingleCase } from "
|
|
1
|
+
import * as chrono from "../../../src";
|
|
2
|
+
import { testSingleCase } from "../../test_util";
|
|
3
3
|
|
|
4
4
|
test("Test - Single Expression", function () {
|
|
5
5
|
testSingleCase(chrono.zh.hans, "五日内我要通关游戏", new Date(2012, 7, 10), (result) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as chrono from "
|
|
2
|
-
import { testSingleCase } from "
|
|
1
|
+
import * as chrono from "../../../src";
|
|
2
|
+
import { testSingleCase } from "../../test_util";
|
|
3
3
|
|
|
4
4
|
test("Test - Single Expression", function () {
|
|
5
5
|
testSingleCase(chrono.zh.hans, "我上午6点13分打游戏", new Date(2012, 7, 10), (result) => {
|
|
@@ -47,6 +47,20 @@ test("Test - Single Expression", function () {
|
|
|
47
47
|
const expectDate = new Date(2012, 7, 11, 8);
|
|
48
48
|
expect(expectDate.getTime()).toBeCloseTo(resultDate.getTime());
|
|
49
49
|
});
|
|
50
|
+
|
|
51
|
+
testSingleCase(chrono.zh.hans, "早上8点", new Date(2012, 8 - 1, 10, 12), (result) => {
|
|
52
|
+
expect(result.text).toBe("早上8点");
|
|
53
|
+
|
|
54
|
+
expect(result.start).not.toBeNull();
|
|
55
|
+
expect(result.start.get("year")).toBe(2012);
|
|
56
|
+
expect(result.start.get("month")).toBe(8);
|
|
57
|
+
expect(result.start.get("day")).toBe(10);
|
|
58
|
+
expect(result.start.get("hour")).toBe(8);
|
|
59
|
+
|
|
60
|
+
const resultDate = result.start.date();
|
|
61
|
+
const expectDate = new Date(2012, 8 - 1, 10, 8);
|
|
62
|
+
expect(expectDate.getTime()).toBeCloseTo(resultDate.getTime());
|
|
63
|
+
});
|
|
50
64
|
});
|
|
51
65
|
|
|
52
66
|
test("Test - Range Expression", function () {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as chrono from "
|
|
2
|
-
import { testSingleCase } from "
|
|
1
|
+
import * as chrono from "../../../src";
|
|
2
|
+
import { testSingleCase } from "../../test_util";
|
|
3
3
|
|
|
4
4
|
test("Test - Single Expression", function () {
|
|
5
5
|
testSingleCase(chrono.zh.hans, "星期四", new Date(2016, 9 - 1, 2), (result) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as chrono from "
|
|
2
|
-
import { testSingleCase } from "
|
|
1
|
+
import * as chrono from "../../../src";
|
|
2
|
+
import { testSingleCase } from "../../test_util";
|
|
3
3
|
|
|
4
4
|
test("Test - Single Expression", function () {
|
|
5
5
|
testSingleCase(chrono.zh.hant, "雞而家全部都係雞", new Date(2012, 7, 10, 8, 9, 10, 11), (result) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as chrono from "
|
|
2
|
-
import { testSingleCase } from "
|
|
1
|
+
import * as chrono from "../../../src";
|
|
2
|
+
import { testSingleCase } from "../../test_util";
|
|
3
3
|
|
|
4
4
|
test("Test - Single Expression", function () {
|
|
5
5
|
testSingleCase(chrono.zh.hant, "雞2016年9月3號全部都係雞", new Date(2012, 8 - 1, 10), (result) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as chrono from "
|
|
2
|
-
import { testSingleCase } from "
|
|
1
|
+
import * as chrono from "../../../src";
|
|
2
|
+
import { testSingleCase } from "../../test_util";
|
|
3
3
|
|
|
4
4
|
test("Test - Single Expression", function () {
|
|
5
5
|
testSingleCase(chrono.zh.hant, "五日內我地有d野做", new Date(2012, 7, 10), (result) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as chrono from "
|
|
2
|
-
import { testSingleCase } from "
|
|
1
|
+
import * as chrono from "../../../src";
|
|
2
|
+
import { testSingleCase } from "../../test_util";
|
|
3
3
|
|
|
4
4
|
test("Test - Single Expression", function () {
|
|
5
5
|
testSingleCase(chrono.zh.hant, "雞上午6點13分全部都係雞", new Date(2012, 7, 10), (result) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as chrono from "
|
|
2
|
-
import { testSingleCase } from "
|
|
1
|
+
import * as chrono from "../../../src";
|
|
2
|
+
import { testSingleCase } from "../../test_util";
|
|
3
3
|
|
|
4
4
|
test("Test - Single Expression", function () {
|
|
5
5
|
testSingleCase(chrono.zh.hant, "星期四", new Date(2016, 9 - 1, 2), (result) => {
|
package/test/zh/zh.test.ts
CHANGED
|
@@ -16,3 +16,21 @@ test("Test - International compatible", () => {
|
|
|
16
16
|
expect(result.start).toBeDate(new Date(784043130000));
|
|
17
17
|
});
|
|
18
18
|
});
|
|
19
|
+
|
|
20
|
+
test("Test - Default Zh setting combine both hans/hant", () => {
|
|
21
|
+
testSingleCase(chrono.zh, "明天早上8点", new Date(2012, 8 - 1, 8, 12), (result) => {
|
|
22
|
+
expect(result.text).toBe("明天早上8点");
|
|
23
|
+
expect(result.start.get("year")).toBe(2012);
|
|
24
|
+
expect(result.start.get("month")).toBe(8);
|
|
25
|
+
expect(result.start.get("day")).toBe(9);
|
|
26
|
+
expect(result.start.get("hour")).toBe(8);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
testSingleCase(chrono.zh, "明天早上8點", new Date(2012, 8 - 1, 8, 12), (result) => {
|
|
30
|
+
expect(result.text).toBe("明天早上8點");
|
|
31
|
+
expect(result.start.get("year")).toBe(2012);
|
|
32
|
+
expect(result.start.get("month")).toBe(8);
|
|
33
|
+
expect(result.start.get("day")).toBe(9);
|
|
34
|
+
expect(result.start.get("hour")).toBe(8);
|
|
35
|
+
});
|
|
36
|
+
});
|