Skip to content

Commit

Permalink
Made the LAST_DATE const so that it can not be changed.
Browse files Browse the repository at this point in the history
  • Loading branch information
MohitMaliDeveloper committed Jan 3, 2025
1 parent fb88911 commit d06985e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/VersionCodeGenerator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit d06985e

Please sign in to comment.