Allow localised date format

pull/823/head
ahmedmadhoun1 2 years ago
parent 89c4653115
commit 3114b2eeaa

@ -70,6 +70,7 @@ import kotlinx.datetime.Instant
import kotlinx.datetime.toJavaInstant
import java.time.ZoneId
import java.time.format.DateTimeFormatter
import java.time.format.FormatStyle
import java.util.Locale
import com.google.samples.apps.nowinandroid.core.designsystem.R as DesignsystemR
@ -230,8 +231,11 @@ fun dateFormatted(publishDate: Instant): String {
}
}
return DateTimeFormatter.ofPattern("MMM d, yyyy")
.withZone(zoneId).format(publishDate.toJavaInstant())
return DateTimeFormatter
.ofLocalizedDate(FormatStyle.MEDIUM)
.withLocale(Locale.getDefault())
.withZone(zoneId)
.format(publishDate.toJavaInstant())
}
@Composable

Loading…
Cancel
Save