Created
October 30, 2023 16:13
-
-
Save V-Abhilash-1999/ed06e5137152dd004ae3b892e5f5dc88 to your computer and use it in GitHub Desktop.
Month Text
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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