Add weekday to dates
This commit is contained in:
13
src/bot.rs
13
src/bot.rs
@@ -1,4 +1,5 @@
|
||||
use anyhow::{Error, Result};
|
||||
use chrono::Datelike;
|
||||
use chrono::Utc;
|
||||
use chrono_tz::Europe;
|
||||
use diesel::Connection;
|
||||
@@ -145,10 +146,20 @@ pub async fn fetch_and_announce_appointment(
|
||||
.with_timezone(&Europe::Berlin)
|
||||
.format("%d.%m.%Y %H:%M");
|
||||
|
||||
let weekday = match appointment.start.weekday() {
|
||||
chrono::Weekday::Mon => "Montag",
|
||||
chrono::Weekday::Tue => "Dienstag",
|
||||
chrono::Weekday::Wed => "Mittwoch",
|
||||
chrono::Weekday::Thu => "Donnerstag",
|
||||
chrono::Weekday::Fri => "Freitag",
|
||||
chrono::Weekday::Sat => "Samstag",
|
||||
chrono::Weekday::Sun => "Sonntag",
|
||||
};
|
||||
|
||||
let announcement = bot
|
||||
.send_message(
|
||||
ChatId(chat_info.id),
|
||||
format!("Nächster Termin: {}", date_str),
|
||||
format!("Nächster Termin: {}, {}", weekday, date_str),
|
||||
)
|
||||
.await?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user