fix: 修复还有多少天变成负数的问题
This commit is contained in:
@@ -36,7 +36,7 @@ create table habit_record
|
||||
update_time datetime null,
|
||||
name varchar(100) not null,
|
||||
date date not null comment '重要的日期',
|
||||
type enum ('anniversary', 'commemoration') default 'anniversary' not null
|
||||
type enum ('ANNIVERSARY', 'COMMEMORATION') default 'ANNIVERSARY' not null
|
||||
)
|
||||
comment '周年纪念日';
|
||||
|
||||
|
@@ -35,9 +35,9 @@ public class AnniversaryServiceImpl extends ServiceImpl<AnniversaryMapper, Anniv
|
||||
date = date.withYear(now.getYear() + 1);
|
||||
}
|
||||
|
||||
aList.add(new AnniversaryRecord(anniversary.getName(), date.toString(), (int) ChronoUnit.DAYS.between(date, now)));
|
||||
aList.add(new AnniversaryRecord(anniversary.getName(), date.toString(), (int) ChronoUnit.DAYS.between(now, date)));
|
||||
} else if (anniversary.getType() == AnniversaryEnum.COMMEMORATION) {
|
||||
bList.add(new AnniversaryRecord(anniversary.getName(), anniversary.getDate().toString(), (int) ChronoUnit.DAYS.between(now, anniversary.getDate())));
|
||||
bList.add(new AnniversaryRecord(anniversary.getName(), anniversary.getDate().toString(), (int) ChronoUnit.DAYS.between(anniversary.getDate(), now)));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user