Skip to content

Commit

Permalink
[Android] Display date and time for valid from and until properties (…
Browse files Browse the repository at this point in the history
…#67)

This includes parsing time when displaying the valid from and until properties on the Android app.
  • Loading branch information
Juliano1612 authored Dec 18, 2024
1 parent 69567de commit 1c00769
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ fun CredentialDate(dateString: String) {
return@LaunchedEffect
} catch (_: Exception) {
}

// date time yyyy-MM-dd'T'HH:mm:ss.SSSSSSSS'Z'
try {
val parsedDate = OffsetDateTime.parse(dateString)
val localZoneParsedDate = parsedDate.atZoneSameInstant(ZoneId.systemDefault())
val dateTimeFormatter = DateTimeFormatter.ofPattern("MMM dd, yyyy 'at' h:mm a")
date = localZoneParsedDate.format(dateTimeFormatter)
return@LaunchedEffect
} catch (_: Exception) {
}

// date only
try {
Expand Down

0 comments on commit 1c00769

Please sign in to comment.