diff --git a/status/src/solar_client.rs b/status/src/solar_client.rs index 8e38023..0aa7d5c 100644 --- a/status/src/solar_client.rs +++ b/status/src/solar_client.rs @@ -20,16 +20,16 @@ pub struct SunMoon { impl SunMoon { fn from_js(day: Date, val: SunMoonJs) -> Self { - fn kreu_tempo(day: Date, val: String) -> Option> { + fn new_time(day: Date, val: String) -> Option> { NaiveTime::parse_from_str(&val, "%H:%M") .map(|tempo| day.and_hms(tempo.hour(), tempo.minute(), 0)) .ok() } - let sunrise = kreu_tempo(day.clone(), val.sunrise).unwrap(); - let sunset = kreu_tempo(day.clone(), val.sunset).unwrap(); - let moonrise = val.moonrise.and_then(|v| kreu_tempo(day.clone(), v)); - let moonset = val.moonset.and_then(|v| kreu_tempo(day.clone(), v)); + let sunrise = new_time(day.clone(), val.sunrise).unwrap(); + let sunset = new_time(day.clone(), val.sunset).unwrap(); + let moonrise = val.moonrise.and_then(|v| new_time(day.clone(), v)); + let moonset = val.moonset.and_then(|v| new_time(day.clone(), v)); Self { sunrise,