Skip to content

Commit dc44a44

Browse files
santosh-pingleSantosh Pingle
andauthored
perform parsing on datetype value. (#2723)
Co-authored-by: Santosh Pingle <[email protected]>
1 parent 17029eb commit dc44a44

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

demo/src/main/java/com/google/android/fhir/demo/PatientListViewModel.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023 Google LLC
2+
* Copyright 2023-2024 Google LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -28,7 +28,7 @@ import com.google.android.fhir.search.StringFilterModifier
2828
import com.google.android.fhir.search.count
2929
import com.google.android.fhir.search.search
3030
import java.time.LocalDate
31-
import java.time.format.DateTimeFormatter
31+
import java.time.ZoneId
3232
import kotlinx.coroutines.launch
3333
import org.hl7.fhir.r4.model.Patient
3434
import org.hl7.fhir.r4.model.RiskAssessment
@@ -183,7 +183,7 @@ internal fun Patient.toPatientItem(position: Int): PatientListViewModel.PatientI
183183
val gender = if (hasGenderElement()) genderElement.valueAsString else ""
184184
val dob =
185185
if (hasBirthDateElement()) {
186-
LocalDate.parse(birthDateElement.valueAsString, DateTimeFormatter.ISO_DATE)
186+
birthDateElement.value.toInstant().atZone(ZoneId.systemDefault()).toLocalDate()
187187
} else {
188188
null
189189
}

0 commit comments

Comments
 (0)