fix(helpers): interpretation of plain numbers as time

- leading zeroes are not ignored anymore
- no odd jump between 59 and 60
This commit is contained in:
xeruf 2025-01-15 22:08:15 +01:00
parent a1347def62
commit ee33086824

View file

@ -44,8 +44,8 @@ pub fn parse_hour_after<T: TimeZone>(str: &str, after: DateTime<T>) -> Option<Da
str.parse::<u32>().ok().and_then(|number| {
#[allow(deprecated)]
after.date().and_hms_opt(
if number > 23 { number / 100 } else { number },
if number > 23 { number % 100 } else { 0 },
if str.len() > 2 { number / 100 } else { number },
if str.len() > 2 { number % 100 } else { 0 },
0,
).map(|time| {
if time < after {