Closed Uselesslav closed 6 years ago
In Kotlin.
Initialization:
calendar.init(minDate, maxDate, MonthFormat("MMMM yyyy", Locale.getDefault()))
.inMode(CalendarPickerView.SelectionMode.RANGE)
Class MonthFormat:
class MonthFormat(pattern: String, locale: Locale) : SimpleDateFormat(pattern, locale) {
private val months = arrayOf(
"Январь", "Февраль", "Март", "Апрель", "Май", "Июнь",
"Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь")
override fun format(date: Date?, toAppendTo: StringBuffer?, pos: FieldPosition?): StringBuffer {
val sb = StringBuffer()
calendar.time = date
sb.append(months[calendar.get(Calendar.MONTH)])
.append(" ")
.append(calendar.get(Calendar.YEAR))
return sb
}
}
Январь - January Февраль - February Март - March Апрель - April Май - May Июнь - June Июль - July Август - August Сентябрь - September Октябрь - October Ноябрь - November Декабрь - December