fix: fixed issue with month not being passed correctly

This commit is contained in:
moonleay 2024-01-18 08:46:13 +01:00
parent b1fc971825
commit 3e8a2d2d83
Signed by: moonleay
GPG key ID: 82667543CCD715FB

View file

@ -173,7 +173,7 @@ object TimeUtil {
val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")
val zoneId = ZoneId.of(zone)
val now = ZonedDateTime.now(zoneId)
val localDateTime = LocalDateTime.parse("${now.year}-${now.monthValue}-${if (now.dayOfMonth < 10) "0${now.dayOfMonth}" else now.dayOfMonth} $inp", formatter)
val localDateTime = LocalDateTime.parse("${now.year}-${if (now.monthValue < 10) "0${now.monthValue}" else now.monthValue}-${if (now.dayOfMonth < 10) "0${now.dayOfMonth}" else now.dayOfMonth} $inp", formatter)
val zdtPre = ZonedDateTime.of(localDateTime, zoneId)
if(zdtPre.isBefore(now))
return zdtPre.plusDays(1)