From ce830093f951acd8d4ce6e95aea56d4437e89af9 Mon Sep 17 00:00:00 2001 From: MohitMaliFtechiz Date: Fri, 3 Jan 2025 17:26:42 +0530 Subject: [PATCH] Made the `LAST_DATE` const so that it can not be changed. --- buildSrc/src/main/kotlin/VersionCodeGenerator.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/kotlin/VersionCodeGenerator.kt b/buildSrc/src/main/kotlin/VersionCodeGenerator.kt index 392bb5b14..c962a9d47 100644 --- a/buildSrc/src/main/kotlin/VersionCodeGenerator.kt +++ b/buildSrc/src/main/kotlin/VersionCodeGenerator.kt @@ -22,7 +22,7 @@ import java.time.temporal.ChronoUnit /** * The date when the automatic version code generation started. */ -val LAST_DATE: LocalDate = LocalDate.of(2024, 7, 17) +const val LAST_DATE = "2024-07-17" /** * Base version code. This is the version code of the last release uploaded to the Play Store. @@ -43,7 +43,7 @@ fun String.getVersionCode(): Int { } // Calculate the number of days between the LAST_DATE and today's date. // This gives us the total number of days since the last version code was set. - val daysDifference = ChronoUnit.DAYS.between(LAST_DATE, currentDate).toInt() + val daysDifference = ChronoUnit.DAYS.between(LocalDate.parse(LAST_DATE), currentDate).toInt() // Generate and return the new version code. // The new version code is calculated by adding the number of days since LAST_DATE