diff --git a/CHANGELOG.md b/CHANGELOG.md index 49dda4438c..5220203107 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # TelegramBotAPI changelog +## 23.2.1 + +* `Core`: + * Fix of `year` field in `Birthdate` + ## 23.2.0 **THIS UPDATE CONTAINS ADDING SUPPORT OF [Telegram Bots API 8.3](https://core.telegram.org/bots/api-changelog#february-12-2025)** diff --git a/gradle.properties b/gradle.properties index ad4f6dd1a6..1677ba08ad 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,4 +6,4 @@ kotlin.incremental=true kotlin.incremental.js=true library_group=dev.inmo -library_version=23.2.0 +library_version=23.2.1 diff --git a/tgbotapi.core/api/tgbotapi.core.api b/tgbotapi.core/api/tgbotapi.core.api index 04e4a0e281..6a7372ceb5 100644 --- a/tgbotapi.core/api/tgbotapi.core.api +++ b/tgbotapi.core/api/tgbotapi.core.api @@ -8307,17 +8307,18 @@ public abstract interface class dev/inmo/tgbotapi/types/BackgroundType$WithDocum public final class dev/inmo/tgbotapi/types/Birthdate { public static final field Companion Ldev/inmo/tgbotapi/types/Birthdate$Companion; - public fun (III)V + public fun (IILjava/lang/Integer;)V + public synthetic fun (IILjava/lang/Integer;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()I public final fun component2 ()I - public final fun component3 ()I - public final fun copy (III)Ldev/inmo/tgbotapi/types/Birthdate; - public static synthetic fun copy$default (Ldev/inmo/tgbotapi/types/Birthdate;IIIILjava/lang/Object;)Ldev/inmo/tgbotapi/types/Birthdate; + public final fun component3 ()Ljava/lang/Integer; + public final fun copy (IILjava/lang/Integer;)Ldev/inmo/tgbotapi/types/Birthdate; + public static synthetic fun copy$default (Ldev/inmo/tgbotapi/types/Birthdate;IILjava/lang/Integer;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/Birthdate; public fun equals (Ljava/lang/Object;)Z public final fun getDate-1iQqF6g ()I public final fun getDay ()I public final fun getMonth ()I - public final fun getYear ()I + public final fun getYear ()Ljava/lang/Integer; public fun hashCode ()I public fun toString ()Ljava/lang/String; } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Birthdate.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Birthdate.kt index 4a0ddd7e45..b3121bb0ba 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Birthdate.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Birthdate.kt @@ -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) } }