mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-09-03 23:29:33 +00:00
fix of year in Birthdate
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package dev.inmo.tgbotapi.types
|
||||
|
||||
import korlibs.time.Date
|
||||
import korlibs.time.DateTime
|
||||
import korlibs.time.Year
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@@ -11,9 +13,12 @@ data class Birthdate(
|
||||
@SerialName(monthField)
|
||||
val month: Int,
|
||||
@SerialName(yearField)
|
||||
val year: Int
|
||||
val year: Int? = null
|
||||
) {
|
||||
/**
|
||||
* Represents this birthday as korlibs [Date]. Will use this year in case if [year] has not been retrieved
|
||||
*/
|
||||
val date: Date by lazy {
|
||||
Date(year, month, day)
|
||||
Date(year ?: DateTime.now().year.year, month, day)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user