-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Migrate *Attributes time fields from Date to Instant #8636 #8637
Migrate *Attributes time fields from Date to Instant #8636 #8637
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice PR. Just a small comment.
@@ -259,26 +259,24 @@ public void testSanitizeForSaving() { | |||
|
|||
@Test | |||
public void testSendDateForDisplay() { | |||
Calendar calendar = formatDateForAdminEmailAttributesTest(validAdminEmailAttributesObject.sendDate); | |||
String expectedDate = TimeHelper.formatTime12H(calendar.getTime()); | |||
validAdminEmailAttributesObject.sendDate = Instant.now(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change in the logic of the test intentional? The original test does not set this field. Ok, I see that this is for consistency with the test below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original test coupled it together with formatDateForAdminEmailAttributesTest
, which I believe was a mistake.
Calendar calendar = Calendar.getInstance(); | ||
calendar.setTime(date); | ||
return TimeHelper.convertToUserTimeZone(calendar, Const.SystemParams.ADMIN_TIME_ZONE_DOUBLE); | ||
private LocalDateTime formatDateForAdminEmailAttributesTest(Instant date) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name doesn't make sense. It should be something like convertToAdminTime
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
23170db
to
b82e8c7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Fixes #8636
Based on #8629. Commits start from 6768e02.Script used to migrate timestamps in JSON data: