darkokoa / compose-datetime-wheel-picker

Wheel Date & Time Picker in Compose Multiplatform
24 stars 1 forks source link

Add map month name #12

Open AndroidLab opened 1 month ago

AndroidLab commented 1 month ago

Is it possible to add a custom option to set the name of the month?

@Composable
fun WheelDatePicker(
...
  selectorProperties: SelectorProperties = WheelPickerDefaults.selectorProperties(),
  onMapMonthName: (name: String) -> String = { it },
  onSnappedDate: (snappedDate: LocalDate) -> Unit = {}
) 
@Composable
internal fun DefaultWheelDatePicker(
...
  selectorProperties: SelectorProperties = WheelPickerDefaults.selectorProperties(),
  onMapMonthName: (name: String) -> String = { it },
  onSnappedDate: (snappedDate: SnappedDate) -> Int? = { _ -> null }
) {
  ...
  val months = (1..12).map {
    val monthName = onMapMonthName(
        Month(it).name.lowercase().replaceFirstChar { char -> char.titlecase() }
    )
...
}
darkokoa commented 1 month ago

This looks good, worth considering.