From 736c8bde010c9b17b5806fe729a6f53146050acf Mon Sep 17 00:00:00 2001 From: Noor Dawod Date: Thu, 11 Apr 2024 13:51:55 +0200 Subject: [PATCH] Fix a bug when extracting the date from a log file name. --- CHANGES.txt | 3 +++ build.gradle.kts | 2 +- src/commonMain/kotlin/com/airthings/lib/logging/LogDate.kt | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index cf2a40a..ecf1e77 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,6 @@ +0.2.6 - April 11, 2024 +• Fix a bug when extracting the date from a log file name. + 0.2.5 - April 11, 2024 • Fix a bug when computing the log date from a file name. • Expose `FileLoggerFacility.baseFolder` property to public use. diff --git a/build.gradle.kts b/build.gradle.kts index 1e371c0..c976e8d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -18,7 +18,7 @@ */ rootProject.group = "com.airthings.lib" -rootProject.version = "0.2.5" +rootProject.version = "0.2.6" buildscript { repositories { diff --git a/src/commonMain/kotlin/com/airthings/lib/logging/LogDate.kt b/src/commonMain/kotlin/com/airthings/lib/logging/LogDate.kt index 572fe95..a6904c1 100644 --- a/src/commonMain/kotlin/com/airthings/lib/logging/LogDate.kt +++ b/src/commonMain/kotlin/com/airthings/lib/logging/LogDate.kt @@ -115,7 +115,7 @@ fun String.asLogDate(separator: Char?): LogDate? { return null } - val dateAsStringValue = dateAsIntValue.padded(expectedLength) + val dateAsStringValue = dateAsIntValue.padded(LogDate.LOG_FILE_LENGTH_WITHOUT_SEPARATOR) val year = dateAsStringValue.substring(0, 4).toIntOrNull() ?: return null val month = dateAsStringValue.substring(4, 6).toIntOrNull() ?: return null