Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
0deca752
Commit
0deca752
authored
Feb 07, 2025
by
刘林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:(jg) 设备注册代码生成未考虑闰年,导致2月29非法日期bug处理
parent
690b9ca7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
DateUtils.java
...om/yeejoin/amos/boot/module/ymt/api/common/DateUtils.java
+6
-2
No files found.
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-api/src/main/java/com/yeejoin/amos/boot/module/ymt/api/common/DateUtils.java
View file @
0deca752
...
...
@@ -15,11 +15,15 @@ public class DateUtils {
public
static
Date
calculateEndOfMonth
(
Date
currentDate
)
{
LocalDateTime
localDateTime
=
toLocalDateTime
(
currentDate
);
LocalDateTime
endOfMonth
=
localDateTime
.
with
(
localDateTime
.
withDayOfMonth
(
localDateTime
.
getMonth
().
maxLength
())
// 获取当前月份的实际天数(考虑闰年)
int
lastDay
=
localDateTime
.
getMonth
().
length
(
localDateTime
.
toLocalDate
().
isLeapYear
());
// 直接设置为本月最后一天 23:59:59.999
LocalDateTime
endOfMonth
=
localDateTime
.
withDayOfMonth
(
lastDay
)
.
withHour
(
23
)
.
withMinute
(
59
)
.
withSecond
(
59
)
.
withNano
(
999
999999
)
);
.
withNano
(
999
_999_999
);
return
toDate
(
endOfMonth
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment