Skip to content

Commit

Permalink
修改日期格式化案例
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuangjiaju committed Jun 18, 2024
1 parent 5844e5f commit c52385f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,17 @@ private void readCn(File file) {
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(
Expand Down
Binary file modified easyexcel-test/src/test/resources/dataformat/dataformat.xls
Binary file not shown.
Binary file modified easyexcel-test/src/test/resources/dataformat/dataformat.xlsx
Binary file not shown.

0 comments on commit c52385f

Please sign in to comment.