mirror of
https://github.com/Garmelon/Arbeitszeitdokumentationsgenerator.git
synced 2026-04-12 16:55:04 +02:00
Switch from time to jiff
This commit is contained in:
parent
afd6546639
commit
26dd613bbc
3 changed files with 34 additions and 17 deletions
|
|
@ -3,9 +3,9 @@ use axum::{
|
|||
response::{IntoResponse, Response},
|
||||
};
|
||||
use axum_extra::extract::Form;
|
||||
use jiff::{ToSpan, Zoned};
|
||||
use maud::{html, Markup, PreEscaped};
|
||||
use serde::Deserialize;
|
||||
use time::{macros::format_description, OffsetDateTime};
|
||||
|
||||
use crate::{
|
||||
endpoints::page,
|
||||
|
|
@ -13,9 +13,12 @@ use crate::{
|
|||
};
|
||||
|
||||
pub async fn get() -> Markup {
|
||||
let now = OffsetDateTime::now_local().unwrap_or_else(|_| OffsetDateTime::now_utc());
|
||||
let month = now.date().replace_day(1).unwrap().previous_day().unwrap();
|
||||
let month = month.format(format_description!("[year]-[month]")).unwrap();
|
||||
// We assume that people still want to fill out the previous month's time
|
||||
// sheet during the first two weeks of the following month.
|
||||
let month = Zoned::now()
|
||||
.checked_sub(2.weeks())
|
||||
.unwrap()
|
||||
.strftime("%Y-%m");
|
||||
|
||||
page(
|
||||
html! {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue