mirror of
https://github.com/Garmelon/Arbeitszeitdokumentationsgenerator.git
synced 2026-04-12 08:45:05 +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
38
Cargo.lock
generated
38
Cargo.lock
generated
|
|
@ -106,9 +106,9 @@ dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"comemo",
|
"comemo",
|
||||||
"fontdb 0.22.0",
|
"fontdb 0.22.0",
|
||||||
|
"jiff",
|
||||||
"maud",
|
"maud",
|
||||||
"serde",
|
"serde",
|
||||||
"time",
|
|
||||||
"tokio",
|
"tokio",
|
||||||
"typst",
|
"typst",
|
||||||
"typst-pdf",
|
"typst-pdf",
|
||||||
|
|
@ -1144,6 +1144,31 @@ version = "1.0.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
|
checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "jiff"
|
||||||
|
version = "0.1.13"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8a45489186a6123c128fdf6016183fcfab7113e1820eb813127e036e287233fb"
|
||||||
|
dependencies = [
|
||||||
|
"jiff-tzdb-platform",
|
||||||
|
"windows-sys 0.59.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "jiff-tzdb"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "91335e575850c5c4c673b9bd467b0e025f164ca59d0564f69d0c2ee0ffad4653"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "jiff-tzdb-platform"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9835f0060a626fe59f160437bc725491a6af23133ea906500027d1bd2f8f4329"
|
||||||
|
dependencies = [
|
||||||
|
"jiff-tzdb",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "jpeg-decoder"
|
name = "jpeg-decoder"
|
||||||
version = "0.3.1"
|
version = "0.3.1"
|
||||||
|
|
@ -1343,15 +1368,6 @@ dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "num_threads"
|
|
||||||
version = "0.1.7"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9"
|
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "numerals"
|
name = "numerals"
|
||||||
version = "0.1.4"
|
version = "0.1.4"
|
||||||
|
|
@ -2141,9 +2157,7 @@ checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"deranged",
|
"deranged",
|
||||||
"itoa",
|
"itoa",
|
||||||
"libc",
|
|
||||||
"num-conv",
|
"num-conv",
|
||||||
"num_threads",
|
|
||||||
"powerfmt",
|
"powerfmt",
|
||||||
"serde",
|
"serde",
|
||||||
"time-core",
|
"time-core",
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,9 @@ axum-extra = { version = "0.9.4", features = ["form"] }
|
||||||
clap = { version = "4.5.20", features = ["derive", "deprecated"] }
|
clap = { version = "4.5.20", features = ["derive", "deprecated"] }
|
||||||
comemo = "0.4.0"
|
comemo = "0.4.0"
|
||||||
fontdb = "0.22.0"
|
fontdb = "0.22.0"
|
||||||
|
jiff = "0.1.13"
|
||||||
maud = { version = "0.26.0", features = ["axum"] }
|
maud = { version = "0.26.0", features = ["axum"] }
|
||||||
serde = { version = "1.0.210", features = ["derive"] }
|
serde = { version = "1.0.210", features = ["derive"] }
|
||||||
time = { version = "0.3.36", features = ["macros", "formatting", "local-offset"] }
|
|
||||||
tokio = { version = "1.40.0", features = ["full"] }
|
tokio = { version = "1.40.0", features = ["full"] }
|
||||||
typst = "0.11.1"
|
typst = "0.11.1"
|
||||||
typst-pdf = "0.11.1"
|
typst-pdf = "0.11.1"
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@ use axum::{
|
||||||
response::{IntoResponse, Response},
|
response::{IntoResponse, Response},
|
||||||
};
|
};
|
||||||
use axum_extra::extract::Form;
|
use axum_extra::extract::Form;
|
||||||
|
use jiff::{ToSpan, Zoned};
|
||||||
use maud::{html, Markup, PreEscaped};
|
use maud::{html, Markup, PreEscaped};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use time::{macros::format_description, OffsetDateTime};
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
endpoints::page,
|
endpoints::page,
|
||||||
|
|
@ -13,9 +13,12 @@ use crate::{
|
||||||
};
|
};
|
||||||
|
|
||||||
pub async fn get() -> Markup {
|
pub async fn get() -> Markup {
|
||||||
let now = OffsetDateTime::now_local().unwrap_or_else(|_| OffsetDateTime::now_utc());
|
// We assume that people still want to fill out the previous month's time
|
||||||
let month = now.date().replace_day(1).unwrap().previous_day().unwrap();
|
// sheet during the first two weeks of the following month.
|
||||||
let month = month.format(format_description!("[year]-[month]")).unwrap();
|
let month = Zoned::now()
|
||||||
|
.checked_sub(2.weeks())
|
||||||
|
.unwrap()
|
||||||
|
.strftime("%Y-%m");
|
||||||
|
|
||||||
page(
|
page(
|
||||||
html! {
|
html! {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue