Skip to content

Instantly share code, notes, and snippets.

@V-Abhilash-1999
Created October 30, 2023 16:13
Show Gist options
  • Save V-Abhilash-1999/ed06e5137152dd004ae3b892e5f5dc88 to your computer and use it in GitHub Desktop.
Save V-Abhilash-1999/ed06e5137152dd004ae3b892e5f5dc88 to your computer and use it in GitHub Desktop.
Month Text
val year = currentSelectedDate.get(Calendar.YEAR).getFormattedNumber(locale)
val monthText = remember(year, month) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
java.time.YearMonth.of(year, month).month.getDisplayName(java.time.format.TextStyle.FULL, locale)
} else {
Calendar.getInstance(locale).apply {
set(year, month - 1, 1)
}.getDisplayName(Calendar.MONTH, Calendar.LONG, locale) ?: ""
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment