Skip to content

HTML-1988 - Setting the timezone were instead of having it already as…#58

Open
icrc-toliveira wants to merge 1 commit intoopenmrs:masterfrom
icrc-toliveira:RA-1988
Open

HTML-1988 - Setting the timezone were instead of having it already as…#58
icrc-toliveira wants to merge 1 commit intoopenmrs:masterfrom
icrc-toliveira:RA-1988

Conversation

@icrc-toliveira
Copy link
Contributor

@icrc-toliveira icrc-toliveira commented Oct 20, 2022

Issue: https://issues.openmrs.org/browse/RA-1988

Description:
When using a date time picker (with time), it will not store the date with time-zone information.

Problem:

  • Setting the timezone were instead of having it already as… part of the datetimepicker format would lead to a bug
  • Changing visit date did not execute this peace of code.
  • And because of that had no timezone attached
  • To keep it simple and relying on a single implementation being able to parse the 2 types of dates seems the way to go

Related PR's:

… part of the datetimepicker format would lead to a bug

- Changing visit date did not execute this peace of code.
- And because of that had no timezone attached
- To keep it simple and relying on a single implementation being able to parse the 2 types of dates seems the way to go
@mogoodrich
Copy link
Member

Thanks @icrc-toliveira ! Lots of complexity going on here regarding datetimepicker. In the PIH EMR, I don't think we ever use the datetimepicker (or if we do, it's very rare) so I don't have a good way to test all this out... hopefully someone else can review, btu if you find no one reviewing and getting back to you, feel free to ping me and I should be able to merge this in.

@gracepotma
Copy link

@dkayiwa given it's been 2 weeks, could you review this? Or do you think we should defer to @mogoodrich?

This is on ICRC's blockers list.

@gracepotma gracepotma requested a review from dkayiwa November 9, 2022 04:34
df.setLenient(false);
if (dataType.isDateTime() && uiUtils.convertTimezones() && uiUtils.getClientTimezone() != null) {
df.setTimeZone(TimeZone.getTimeZone(uiUtils.getClientTimezone()));
// Datetimepicker can send one of 2 formats "yyyy-MM-dd HH:mm:ss" / "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the conditions which lead to the widget sending either of the two formats?

}
catch (DateTimeParseException e) {
DateFormat df = new SimpleDateFormat(WebConstants.DATE_FORMAT_DATETIME);
df.setLenient(false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you intentionally leave out df.setTimeZone()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants