Skip to content

Commit

Permalink
imp:支持后面/将来十天 (#215)
Browse files Browse the repository at this point in the history
Co-authored-by: zhangsonglei <[email protected]>
  • Loading branch information
zhangsonglei and zhangsonglei authored Feb 28, 2024
1 parent 343381d commit e8d6b13
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ trait Rules extends DimRules {
}
)

private val RecentPattern = "(上|下|近|这|前|)|(后面|过去|未来|接下来|之前|往前|向前|今后|之后|往后|向后|最近)的?"
private val RecentPattern = "(上|下|近|这|前|后面?)|(过去|未来|接下来|之前|往前|向前|今后|之后|往后|向后|最近|将来)的?"

/**
* 时间区间:
Expand All @@ -228,7 +228,7 @@ trait Rules extends DimRules {
val s = if (StringUtils.isBlank(g1)) g2 else g1
// 月必须是x个月
s match {
case "" | "" | "接下来" | "未来" | "今后" | "之后" | "向后" | "往后" | "后面" =>
case "" | "" | "接下来" | "未来" | "今后" | "之后" | "向后" | "往后" | "后面" | "将来" =>
val td: Option[TimeData] =
// 未来一周=未来七天
if ((s == "未来" || s == "接下来") && g == Week) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,14 @@ object Examples extends DimExamples {
),
List("未来一周", "一周内")
),
(
localDateTimeInterval(
LocalDateTime.of(2013, 2, 12, 0, 0, 0),
LocalDateTime.of(2013, 2, 22, 0, 0, 0),
Day
),
List("未来十天", "将来十天", "后面十天", "后十天", "之后十天")
),
(
datetime(LocalDateTime.of(2013, 3, 5, 4, 30, 0), Second),
List("三星期后", "三星期之后", "三个礼拜后", "三个礼拜之后", "三星期以后", "三星期过后")
Expand Down

0 comments on commit e8d6b13

Please sign in to comment.