Updated the rule to parse "last <day-of-week> of <time>"

Summary:
current:
last friday in october -> the date of Friday of previous week
expected:
last friday in october -> the data of last Friday of month october

Reviewed By: chinmay87

Differential Revision: D22201326

fbshipit-source-id: 1983c1b9c24aa356977af7def42d5ba07c7f08be
This commit is contained in:
Bing Yuan 2020-06-25 15:55:28 -07:00 committed by Facebook GitHub Bot
parent 36a3d2011f
commit a78aacfc50
15 changed files with 6218 additions and 6201 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1845,6 +1845,10 @@ allExamples = concat
, examples (datetimeHoliday (2011, 12, 25, 0, 0, 0) Day "Christmas")
[ "the 3rd closest xmas to today"
]
, examples (datetime (2013, 10, 25, 0, 0, 0) Day)
[ "last friday of october"
, "last friday in october"
]
, examples (datetime (2013, 2, 25, 0, 0, 0) Week)
[ "upcoming two weeks"
, "upcoming two week"

View File

@ -223,7 +223,7 @@ ruleLastDOWOfTime = Rule
, pattern =
[ regex "last"
, Predicate isADayOfWeek
, regex "of"
, regex "(of|in)"
, dimension Time
]
, prod = \tokens -> case tokens of