Skip to content

Commit 195976d

Browse files
author
Toby Rothe
committedJun 17, 2022
[FR] small fix for duration
1 parent 73c7da8 commit 195976d

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed
 

‎src/locales/fr/parsers/FRTimeUnitWithinFormatParser.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { AbstractParserWithWordBoundaryChecking } from "../../../common/parsers/
55

66
export default class FRTimeUnitWithinFormatParser extends AbstractParserWithWordBoundaryChecking {
77
innerPattern(): RegExp {
8-
return new RegExp(`(?:dans|en|pour|pendant)\\s*(${TIME_UNITS_PATTERN})(?=\\W|$)`, "i");
8+
return new RegExp(`(?:dans|en|pour|pendant|de)\\s*(${TIME_UNITS_PATTERN})(?=\\W|$)`, "i");
99
}
1010

1111
innerExtract(context: ParsingContext, match: RegExpMatchArray): ParsingComponents {

‎src/locales/ja/parsers/JPStandardParser.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import { findYearClosestToRef } from "../../../calculation/years";
44

55
import dayjs from "dayjs";
66

7-
const PATTERN =
8-
/(?:(?:([])|((||)?([0-9-]{1,4}|)))\s*)?([0-9-]{1,2})\s*([0-9-]{1,2})/i;
7+
const PATTERN = /(?:(?:([])|((||)?([0-9-]{1,4}|)))\s*)?([0-9-]{1,2})\s*([0-9-]{1,2})/i;
98
const SPECIAL_YEAR_GROUP = 1;
109
const TYPICAL_YEAR_GROUP = 2;
1110
const ERA_GROUP = 3;

‎test/fr/fr_time_units_within.test.ts

+7
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ test("Test - Single Expression", function () {
5252
expect(result.start).toBeDate(new Date(2012, 7, 10, 13, 14));
5353
});
5454

55+
testSingleCase(chrono.fr, "régler une minuterie de 5 minutes", new Date(2012, 7, 10, 12, 14), (result) => {
56+
expect(result.index).toBe(21);
57+
expect(result.text).toBe("de 5 minutes");
58+
59+
expect(result.start).toBeDate(new Date(2012, 7, 10, 12, 19));
60+
});
61+
5562
testSingleCase(chrono.fr, "Dans 5 minutes je vais rentrer chez moi", new Date(2012, 7, 10, 12, 14), (result) => {
5663
expect(result.index).toBe(0);
5764
expect(result.text).toBe("Dans 5 minutes");

0 commit comments

Comments
 (0)
Please sign in to comment.