Skip to content

Commit

Permalink
Add Missing Timezone to RS (#17037)
Browse files Browse the repository at this point in the history
* Add Missing Timezone to RS

* Update the timezone
  • Loading branch information
oslynn authored Feb 24, 2025
1 parent a06f23e commit aef18c0
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 13 deletions.
7 changes: 7 additions & 0 deletions frontend-react/src/utils/TemporarySettingsAPITypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,22 @@ enum USTimeZone {
ARIZONA = "ARIZONA",
CENTRAL = "CENTRAL",
CHAMORRO = "CHAMORRO",
CHUUK = "CHUUK",
EASTERN = "EASTERN",
EAST_INDIANA = "EAST_INDIANA",
HAWAII = "HAWAII",
INDIANA_STARKE = "INDIANA_STARKE",
MAJURO = "MAJURO",
MICHIGAN = "MICHIGAN",
MOUNTAIN = "MOUNTAIN",
NORTHERN_MARIANA_ISLANDS = "NORTHERN_MARIANA_ISLANDS",
PACIFIC = "PACIFIC",
PALAU = "PALAU",
PUERTO_RICO = "PUERTO_RICO",
POHNPEI = "POHNPEI",
KOSRAE = "KOSRAE",
SAMOA = "SAMOA",
US_VIRGIN_ISLANDS = "US_VIRGIN_ISLANDS",
UTC = "UTC",
}

Expand Down
30 changes: 18 additions & 12 deletions prime-router/src/main/kotlin/USTimeZone.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,24 @@ package gov.cdc.prime.router

/** The time zones our partners are in */
enum class USTimeZone(val zoneId: String) {
PACIFIC("US/Pacific"),
MOUNTAIN("US/Mountain"),
ARIZONA("US/Arizona"),
CENTRAL("US/Central"),
EASTERN("US/Eastern"),
SAMOA("US/Samoa"),
HAWAII("US/Hawaii"),
EAST_INDIANA("US/East-Indiana"),
INDIANA_STARKE("US/Indiana-Starke"),
MICHIGAN("US/Michigan"),
CHAMORRO("Pacific/Guam"),
ALASKA("US/Alaska"),
PACIFIC("US/Pacific"), // For US Pacific timezone
MOUNTAIN("US/Mountain"), // For US Mountain timezone
ARIZONA("US/Arizona"), // For Arizona timezone (no daylight savings)
CENTRAL("US/Central"), // For US Central timezone
EASTERN("US/Eastern"), // For US Eastern timezone
SAMOA("US/Samoa"), // For American Samoa timezone
HAWAII("US/Hawaii"), // For Hawaii timezone
EAST_INDIANA("US/East-Indiana"), // For Eastern Indiana timezone
INDIANA_STARKE("US/Indiana-Starke"), // For Starke County, Indiana timezone
MICHIGAN("US/Michigan"), // For Michigan timezone
CHAMORRO("Pacific/Guam"), // For Guam and Chamorro timezone
ALASKA("US/Alaska"), // For Alaska timezone
PUERTO_RICO("America/Puerto_Rico"), // For Puerto Rico timezone
US_VIRGIN_ISLANDS("America/St_Thomas"), // For US Virgin Islands timezone
CHUUK("Pacific/Chuuk"), // For Chuuk, Micronesia timezone
POHNPEI("Pacific/Pohnpei"), // For Pohnpei, Micronesia timezone
KOSRAE("Pacific/Kosrae"), // For Kosrae, Micronesia timezone
NORTHERN_MARIANA_ISLANDS("Pacific/Guam"), // For Northern Mariana Islands timezone

// not technically a US time zone but we need it
UTC("UTC"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class CustomTranslationFunctionsTest {
}

@org.junit.jupiter.api.Test
fun `test mojuroTimezone with convertDateTimeToHL7`() {
fun `test MajuroTimezone for Marshall Island timezone with convertDateTimeToHL7`() {
val timezoneParameters1: MutableList<MutableList<Base>> =
mutableListOf(mutableListOf(StringType("Pacific/Majuro")))
val adjustedDateTime =
Expand All @@ -94,6 +94,97 @@ class CustomTranslationFunctionsTest {
assertThat(tmp1).isEqualTo("20150406002211+1200")
}

@org.junit.jupiter.api.Test
fun `test Puerto_RicoTimezone for Puerto Rico timezone with convertDateTimeToHL7`() {
val timezoneParameters1: MutableList<MutableList<Base>> =
mutableListOf(mutableListOf(StringType("America/Puerto_Rico")))
val adjustedDateTime =
CustomFHIRFunctions.changeTimezone(
mutableListOf(DateTimeType("2015-04-05T12:22:11Z")),
timezoneParameters1
)[0] as DateTimeType
val tmp1 = Hl7TranslationFunctions().convertDateTimeToHL7(adjustedDateTime)
assertThat(tmp1).isEqualTo("20150405082211-0400")
}

@org.junit.jupiter.api.Test
fun `test US_Virgin_IslandsTimezone for US Virgin Island timezone with convertDateTimeToHL7`() {
val timezoneParameters1: MutableList<MutableList<Base>> =
mutableListOf(mutableListOf(StringType("America/St_Thomas")))
val adjustedDateTime =
CustomFHIRFunctions.changeTimezone(
mutableListOf(DateTimeType("2015-04-05T12:22:11Z")),
timezoneParameters1
)[0] as DateTimeType
val tmp1 = Hl7TranslationFunctions().convertDateTimeToHL7(adjustedDateTime)
assertThat(tmp1).isEqualTo("20150405082211-0400")
}

@org.junit.jupiter.api.Test
fun `test ChuukTimezone for Micronesia timezone with convertDateTimeToHL7`() {
val timezoneParameters1: MutableList<MutableList<Base>> =
mutableListOf(mutableListOf(StringType("Pacific/Port_Moresby")))
val adjustedDateTime =
CustomFHIRFunctions.changeTimezone(
mutableListOf(DateTimeType("2015-04-05T12:22:11Z")),
timezoneParameters1
)[0] as DateTimeType
val tmp1 = Hl7TranslationFunctions().convertDateTimeToHL7(adjustedDateTime)
assertThat(tmp1).isEqualTo("20150405222211+1000")
}

@org.junit.jupiter.api.Test
fun `test PohnpeiTimezone for Micronesia timezone with convertDateTimeToHL7`() {
val timezoneParameters1: MutableList<MutableList<Base>> =
mutableListOf(mutableListOf(StringType("Pacific/Guadalcanal")))
val adjustedDateTime =
CustomFHIRFunctions.changeTimezone(
mutableListOf(DateTimeType("2015-04-05T12:22:11Z")),
timezoneParameters1
)[0] as DateTimeType
val tmp1 = Hl7TranslationFunctions().convertDateTimeToHL7(adjustedDateTime)
assertThat(tmp1).isEqualTo("20150405232211+1100")
}

@org.junit.jupiter.api.Test
fun `test KosraeTimezone for Micronesia timezone with convertDateTimeToHL7`() {
val timezoneParameters1: MutableList<MutableList<Base>> =
mutableListOf(mutableListOf(StringType("Pacific/Kosrae")))
val adjustedDateTime =
CustomFHIRFunctions.changeTimezone(
mutableListOf(DateTimeType("2015-04-05T12:22:11Z")),
timezoneParameters1
)[0] as DateTimeType
val tmp1 = Hl7TranslationFunctions().convertDateTimeToHL7(adjustedDateTime)
assertThat(tmp1).isEqualTo("20150405232211+1100")
}

@org.junit.jupiter.api.Test
fun `test Northern_Mariana_IslandsTimezone for Northern Mariana Islands timezone with convertDateTimeToHL7`() {
val timezoneParameters1: MutableList<MutableList<Base>> =
mutableListOf(mutableListOf(StringType("Pacific/Saipan")))
val adjustedDateTime =
CustomFHIRFunctions.changeTimezone(
mutableListOf(DateTimeType("2015-04-05T12:22:11Z")),
timezoneParameters1
)[0] as DateTimeType
val tmp1 = Hl7TranslationFunctions().convertDateTimeToHL7(adjustedDateTime)
assertThat(tmp1).isEqualTo("20150405222211+1000")
}

@org.junit.jupiter.api.Test
fun `test PauluTimezone for Palau timezone with convertDateTimeToHL7`() {
val timezoneParameters1: MutableList<MutableList<Base>> =
mutableListOf(mutableListOf(StringType("Pacific/Palau")))
val adjustedDateTime =
CustomFHIRFunctions.changeTimezone(
mutableListOf(DateTimeType("2015-04-05T12:22:11Z")),
timezoneParameters1
)[0] as DateTimeType
val tmp1 = Hl7TranslationFunctions().convertDateTimeToHL7(adjustedDateTime)
assertThat(tmp1).isEqualTo("20150405212211+0900")
}

@org.junit.jupiter.api.Test
fun `test convertDateTimeToHL7 with CustomContext with receiver setting`() {
val receiver = mockkClass(Receiver::class, relaxed = true)
Expand Down

0 comments on commit aef18c0

Please sign in to comment.