Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API-1178 Fix LocalDateTime.fromDate (#1180) [5.0.x] #1193

Merged
merged 1 commit into from
Feb 17, 2022

Conversation

srknzl
Copy link
Member

@srknzl srknzl commented Feb 16, 2022

Clean backport of #1180

LocalDateTime.fromDate using Date's month wrongly. This fixes that. It was throwing right away. I think we should backport this and release soon. Also adds fromDate to LocalDate and LocalTime.

Date.UTC is deleted since I realized that they are not necessary. Tests pass without it. new Date() returns the local time of the system which is like LocalDateTime.now() in java.

The issue happens due to the fact that we don't convert month field of JS Date into our month field. JS Date is 0-11 based and we use 1-12 in LocalDate. Therefore, we should have added 1 to the month field in fromDate constructor. If a user gives a date in january fromDate throws validation error.
@srknzl srknzl added this to the 5.0.4 milestone Feb 16, 2022
@srknzl srknzl changed the title Fix LocalDateTime.fromDate (#1180) Fix LocalDateTime.fromDate (#1180) [5.0.x] Feb 16, 2022
@srknzl srknzl changed the title Fix LocalDateTime.fromDate (#1180) [5.0.x] API-1178 Fix LocalDateTime.fromDate (#1180) [5.0.x] Feb 16, 2022
@codecov
Copy link

codecov bot commented Feb 16, 2022

Codecov Report

Merging #1193 (effe587) into 5.0.x (fdee35d) will decrease coverage by 0.43%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##            5.0.x    #1193      +/-   ##
==========================================
- Coverage   92.63%   92.19%   -0.44%     
==========================================
  Files         438      438              
  Lines       16844    16856      +12     
  Branches     1076     1080       +4     
==========================================
- Hits        15603    15541      -62     
- Misses        958     1028      +70     
- Partials      283      287       +4     
Impacted Files Coverage Δ
src/core/DateTimeClasses.ts 89.38% <100.00%> (-0.44%) ⬇️
src/codec/ClientAuthenticationCustomCodec.ts 40.42% <0.00%> (-34.05%) ⬇️
src/network/ConnectionManager.ts 77.17% <0.00%> (-9.10%) ⬇️
src/config/ConfigBuilder.ts 93.82% <0.00%> (-2.78%) ⬇️
src/invocation/ClusterService.ts 92.19% <0.00%> (-0.71%) ⬇️
src/util/Util.ts 87.42% <0.00%> (-0.63%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fdee35d...effe587. Read the comment docs.

@srknzl srknzl merged commit 1a90983 into hazelcast:5.0.x Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants