Skip to content

Commit

Permalink
将“晚上5点”映射到“下午5点” (#213)
Browse files Browse the repository at this point in the history
  • Loading branch information
du00cs authored Feb 20, 2024
1 parent 8bde148 commit b445cf8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ object FuzzyDayIntervals {
case "上午" => ("上午", (8, 12), (4, 12))
case "中午" | "午间" => ("中午", (12, 14), (10, 15))
case "下午" => ("下午", (12, 18), (12, 0))
case "晚上" | "晚间" | "夜里" | "夜间" | "夜晚" | "" => ("晚上", (18, 0), (18, 0))
case "晚上" | "晚间" | "夜里" | "夜间" | "夜晚" | "" => ("晚上", (18, 0), (17, 0))
case "午夜" | "凌晨" | "半夜" => ("凌晨", (0, 6), (0, 8))
case "傍晚" | "黄昏" => ("傍晚", (17, 19), (16, 20))
}
Expand Down Expand Up @@ -180,7 +180,7 @@ object FuzzyDayIntervals {
else if (h == 12 && (s == "晚上" || s == "晚间")) 24
else {
val (part, (from, _), _) = between(s)
if (part == "晚上" && h < 6) h // 晚上2点 => 凌晨2点
if (part == "晚上" && h < 5) h // 晚上2点 => 凌晨2点
else if (from >= 12 && h < 12) h + 12
else h
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ object Examples extends DimExamples {
(hms(4, 30, 0), List("现在", "此时", "此刻", "当前", "4:30:00", "04点30分0秒")),
(hm(15, 15), List("下午三点十五", "下午3:15", "15:15", "3:15pm", "3:15p.m", "下午三点一刻", "下午的三点一刻")),
(yMdHms(d=13, H=2, grain = Hour), List("晚上两点")),
(yMdHms(d=12, H=17, grain = Hour), List("晚上五点")),
(hm(16, 40), List("十六时四十分", "十六点四十")),
(hm(6, 10), List("六点十分", "六点一十")),
(hms(4, 33, 0), List("过三分钟")),
Expand Down

0 comments on commit b445cf8

Please sign in to comment.