Skip to content

Commit a9745be

Browse files
authored
Merge pull request #1 from inlineapps/fix/next_sunday
fix next sunday issue
2 parents 2c5fc5c + 130b5db commit a9745be

File tree

5 files changed

+58
-39
lines changed

5 files changed

+58
-39
lines changed

date-parser.js

+22-22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/zh-TW.coffee

+1
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ dateExpression2moment = (dateExp, timezone) ->
233233
day = number2integer(match[2])
234234
if match[2].match RegExp(words.end)
235235
day = 6
236+
moment.date moment.date() + 7 if day == 7
236237
day = 0 if day >= 7
237238
moment.day day
238239
if match[2].match RegExp(words.end)

lib/zh-TW.js

+19-14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

script/date-parser.min.js

+4-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/zh-TW.coffee

+12
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,18 @@ describe "dateParser_zh-TW", ->
166166
Moment.tz(timezone).add(1, 'week').day(3).hour(18).minute(17).second(0).unix()
167167
)
168168

169+
it "should recognize 下禮拜天", ->
170+
assert.equal(
171+
dateToUnix dateParser.parse '下禮拜天', timezone
172+
Moment.tz(timezone).add(1, 'week').day(7).hour(0).minute(0).second(0).unix()
173+
)
174+
175+
it "should recognize 10/23", ->
176+
assert.equal(
177+
dateToUnix dateParser.parse '10/23', timezone
178+
Moment.tz(timezone).month(9).date(23).hour(0).minute(0).second(0).unix()
179+
)
180+
169181
it "should recognize 明年1/1 凌晨一點", ->
170182
assert.equal(
171183
dateToUnix dateParser.parse '明年1/1 凌晨一點', timezone

0 commit comments

Comments
 (0)