Closed qligier closed 2 months ago
The utility DateTimes class is badly handling timezones in different methods.
https://github.com/project-husky/husky/blob/5bdc53a5b2870574fc1098e6a9684e38d6eb7cab/husky-common/husky-common-gen/src/main/java/org/projecthusky/common/utils/time/DateTimes.java#L33-L46 The formatters are set to the local zone.
https://github.com/project-husky/husky/blob/5bdc53a5b2870574fc1098e6a9684e38d6eb7cab/husky-common/husky-common-gen/src/main/java/org/projecthusky/common/utils/time/DateTimes.java#L233-L235 Europe/Zurich is hard-coded. I think the method should be renamed to getLocalZonedDateTime, and use ZoneId.systemDefault() instead.
getLocalZonedDateTime
ZoneId.systemDefault()
https://github.com/project-husky/husky/blob/5bdc53a5b2870574fc1098e6a9684e38d6eb7cab/husky-common/husky-common-gen/src/main/java/org/projecthusky/common/utils/time/DateTimes.java#L244-L246 The local zone is assumed. While HL7 says that a DTM without timezone defaults to the local timezone:
Note: If the time zone is not included, the time zone defaults to that of the local time zone of the sender
DTMs used in IHE profiles often (always?) are expressed in UTC.
This should either take a zone, or be split into toLocalHl7Dtm and toUtcHl7Dtm.
toLocalHl7Dtm
toUtcHl7Dtm
https://github.com/project-husky/husky/blob/5bdc53a5b2870574fc1098e6a9684e38d6eb7cab/husky-common/husky-common-gen/src/main/java/org/projecthusky/common/utils/time/DateTimes.java#L256-L260
https://github.com/project-husky/husky/blob/5bdc53a5b2870574fc1098e6a9684e38d6eb7cab/husky-common/husky-common-gen/src/main/java/org/projecthusky/common/utils/time/DateTimes.java#L269-L273
Same thing here.
Some of these methods javadoc did mention (wrongly) UTC was assumed.
The utility DateTimes class is badly handling timezones in different methods.
https://github.com/project-husky/husky/blob/5bdc53a5b2870574fc1098e6a9684e38d6eb7cab/husky-common/husky-common-gen/src/main/java/org/projecthusky/common/utils/time/DateTimes.java#L33-L46 The formatters are set to the local zone.
https://github.com/project-husky/husky/blob/5bdc53a5b2870574fc1098e6a9684e38d6eb7cab/husky-common/husky-common-gen/src/main/java/org/projecthusky/common/utils/time/DateTimes.java#L233-L235 Europe/Zurich is hard-coded. I think the method should be renamed to
getLocalZonedDateTime
, and useZoneId.systemDefault()
instead.https://github.com/project-husky/husky/blob/5bdc53a5b2870574fc1098e6a9684e38d6eb7cab/husky-common/husky-common-gen/src/main/java/org/projecthusky/common/utils/time/DateTimes.java#L244-L246 The local zone is assumed. While HL7 says that a DTM without timezone defaults to the local timezone:
DTMs used in IHE profiles often (always?) are expressed in UTC.
This should either take a zone, or be split into
toLocalHl7Dtm
andtoUtcHl7Dtm
.https://github.com/project-husky/husky/blob/5bdc53a5b2870574fc1098e6a9684e38d6eb7cab/husky-common/husky-common-gen/src/main/java/org/projecthusky/common/utils/time/DateTimes.java#L256-L260
https://github.com/project-husky/husky/blob/5bdc53a5b2870574fc1098e6a9684e38d6eb7cab/husky-common/husky-common-gen/src/main/java/org/projecthusky/common/utils/time/DateTimes.java#L269-L273
Same thing here.