Skip to content

Commit 142235c

Browse files
committed
send_chargelog_to_user: add locales to chrono
1 parent 1eacbbd commit 142235c

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

backend/Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ argon2 = "0.5.3"
2323
diesel = { version = "2.2.9", features = ["postgres", "r2d2", "uuid", "network-address", "chrono"] }
2424
uuid = { version = "1.7.0", features = ["v4"] }
2525
validator = { version = "0.20", features = ["derive"] }
26-
chrono = "0.4.33"
26+
chrono = { version = "0.4.33", features = ["unstable-locales"] }
2727
actix-cors = "0.7.0"
2828
jsonwebtoken = "9.3.1"
2929
futures-util = "0.3.30"

backend/src/routes/send_chargelog_to_user.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,12 @@ pub async fn send_chargelog(
130130
#[cfg(test)]
131131
let lang_str = String::from("en");
132132

133-
let month = chrono::Utc::now().format("%B %Y").to_string();
133+
let month = match lang_str.as_str() {
134+
"de" => chrono::Utc::now()
135+
.format_localized("%B %Y", chrono::Locale::de_DE)
136+
.to_string(),
137+
_ => chrono::Utc::now().format("%B %Y").to_string(),
138+
};
134139

135140
let (body, subject) = render_chargelog_email(&user.name, &month, &payload.filename, &lang_str)?;
136141

0 commit comments

Comments
 (0)