Add native iOS notifications (#64)

This commit is contained in:
Georg Bauer
2026-08-15 12:50:05 +02:00
parent 69d1709523
commit 8ba7f5ad39
23 changed files with 1561 additions and 22 deletions

View File

@@ -174,6 +174,16 @@ pub fn api_date(timestamp: i64) -> String {
format!("{year:04}-{month:02}-{day:02}T00:00:00Z")
}
pub fn api_timestamp(timestamp: i64) -> String {
let days = timestamp.div_euclid(86_400);
let seconds = timestamp.rem_euclid(86_400);
let (year, month, day) = civil_from_days(days);
let hour = seconds / 3_600;
let minute = seconds % 3_600 / 60;
let second = seconds % 60;
format!("{year:04}-{month:02}-{day:02}T{hour:02}:{minute:02}:{second:02}Z")
}
pub fn parse_api_date(value: &str) -> Option<i64> {
let date = value.get(..10)?;
let mut parts = date.split('-');
@@ -230,6 +240,7 @@ mod tests {
assert!(!Page::from_items(vec![(); 29], 30).has_more);
let leap_day = parse_api_date("2024-02-29T12:34:56Z").unwrap();
assert_eq!(api_date(leap_day), "2024-02-29T00:00:00Z");
assert_eq!(api_timestamp(leap_day + 45_296), "2024-02-29T12:34:56Z");
assert_eq!(parse_api_date("2023-02-29T00:00:00Z"), None);
}
}