handlers: fix LAST_MODIFIED date format

Closes #463

Signed-off-by: Xe <me@christine.website>
This commit is contained in:
Cadey Ratio 2022-07-04 14:44:09 +00:00
parent 6be8b24dd2
commit 5d7daf179e
1 changed files with 19 additions and 1 deletions

View File

@ -33,6 +33,24 @@ fn weekday_to_name(w: Weekday) -> &'static str {
} }
} }
fn month_to_name(m: u32) -> &'static str {
match m {
1 => "Jan",
2 => "Feb",
3 => "Mar",
4 => "Apr",
5 => "May",
6 => "Jun",
7 => "Jul",
8 => "Aug",
9 => "Sep",
10 => "Oct",
11 => "Nov",
12 => "Dec",
_ => "Unk",
}
}
lazy_static! { lazy_static! {
static ref HIT_COUNTER: IntCounterVec = static ref HIT_COUNTER: IntCounterVec =
register_int_counter_vec!(opts!("hits", "Number of hits to various pages"), &["page"]) register_int_counter_vec!(opts!("hits", "Number of hits to various pages"), &["page"])
@ -43,7 +61,7 @@ lazy_static! {
"{dayname}, {day} {month} {year} {hour}:{minute}:{second} GMT", "{dayname}, {day} {month} {year} {hour}:{minute}:{second} GMT",
dayname = weekday_to_name(now.weekday()), dayname = weekday_to_name(now.weekday()),
day = now.day(), day = now.day(),
month = now.month(), month = month_to_name(now.month()),
year = now.year(), year = now.year(),
hour = now.hour(), hour = now.hour(),
minute = now.minute(), minute = now.minute(),