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

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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