From 269fb033e052314c2693f18367b5f5e4d3e9d3df Mon Sep 17 00:00:00 2001 From: bggRGjQaUbCoE Date: Wed, 1 Jan 2025 12:54:47 +0800 Subject: [PATCH] opt: shortenChineseDateString Signed-off-by: bggRGjQaUbCoE --- lib/utils/utils.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart index d6224ad2..db823942 100644 --- a/lib/utils/utils.dart +++ b/lib/utils/utils.dart @@ -595,7 +595,9 @@ class Utils { return date.contains("年") ? RegExp(r'\d+') .allMatches(date) - .map((match) => match.group(0)) + .map((match) => match.group(0)?.length == 4 + ? match.group(0)!.substring(2) + : match.group(0)) .join('-') : date; // if (date.contains("年")) return '${date.split("年").first}年';