aboutsummaryrefslogtreecommitdiff
path: root/src/handlers
diff options
context:
space:
mode:
authorXe Iaso <me@christine.website>2022-05-28 09:17:01 -0400
committerXe Iaso <me@christine.website>2022-05-28 09:17:01 -0400
commitbdc64f78f2aeca9730fb27a4c4511d90c93f9d89 (patch)
tree9bc510df9fecff9827c963cda2062ef1a28ca505 /src/handlers
parentff64215d07ee32d53e0a01adcaf0dd8cba273e81 (diff)
downloadxesite-bdc64f78f2aeca9730fb27a4c4511d90c93f9d89.tar.xz
xesite-bdc64f78f2aeca9730fb27a4c4511d90c93f9d89.zip
xeiaso.net
Signed-off-by: Xe Iaso <me@christine.website>
Diffstat (limited to 'src/handlers')
-rw-r--r--src/handlers/mod.rs17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs
index 07c4d52..97e0cb2 100644
--- a/src/handlers/mod.rs
+++ b/src/handlers/mod.rs
@@ -5,7 +5,7 @@ use axum::{
http::StatusCode,
response::{Html, IntoResponse, Response},
};
-use chrono::{Datelike, Timelike, Utc};
+use chrono::{Datelike, Timelike, Utc, Weekday};
use lazy_static::lazy_static;
use prometheus::{opts, register_int_counter_vec, IntCounterVec};
use std::sync::Arc;
@@ -16,6 +16,19 @@ pub mod feeds;
pub mod gallery;
pub mod talks;
+fn weekday_to_name(w: Weekday) -> &'static str {
+ use Weekday::*;
+ match w {
+ Sun => "Sun",
+ Mon => "Mon",
+ Tue => "Tue",
+ Wed => "Wed",
+ Thu => "Thu",
+ Fri => "Fri",
+ Sat => "Sat",
+ }
+}
+
lazy_static! {
static ref HIT_COUNTER: IntCounterVec =
register_int_counter_vec!(opts!("hits", "Number of hits to various pages"), &["page"])
@@ -24,7 +37,7 @@ lazy_static! {
let now = Utc::now();
format!(
"{dayname}, {day} {month} {year} {hour}:{minute}:{second} GMT",
- dayname = now.weekday(),
+ dayname = weekday_to_name(now.weekday()),
day = now.day(),
month = now.month(),
year = now.year(),