修改日期格式化案例

This commit is contained in:
Jiaju Zhuang 2024-06-18 17:51:57 +08:00
parent 5844e5f84e
commit c52385f05b
3 changed files with 5 additions and 3 deletions

View File

@ -47,15 +47,17 @@ public class DateFormatTest {
List<DateFormatData> list =
EasyExcel.read(file, DateFormatData.class, null).locale(Locale.CHINA).sheet().doReadSync();
for (DateFormatData data : list) {
if (data.getDateStringCn() != null && !data.getDateStringCn().equals(data.getDate())) {
log.info("date:cn:{},{}", data.getDateStringCn(), data.getDate());
if (!Objects.equals(data.getDateStringCn(), data.getDate()) && !Objects.equals(data.getDateStringCn2(),
data.getDate())) {
log.info("date:cn:{},{},{}", data.getDateStringCn(), data.getDateStringCn2(), data.getDate());
}
if (data.getNumberStringCn() != null && !data.getNumberStringCn().equals(data.getNumber())) {
log.info("number:cn{},{}", data.getNumberStringCn(), data.getNumber());
}
}
for (DateFormatData data : list) {
// The way dates are read in Chinese is different on Linux and Mac, so it is acceptable if it matches either one.
// The way dates are read in Chinese is different on Linux and Mac, so it is acceptable if it matches
// either one.
// For example, on Linux: 1-Jan -> 1-1月
// On Mac: 1-Jan -> 1-一月
Assertions.assertTrue(