fix tz issue
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 5m36s
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 5m36s
This commit is contained in:
parent
12e4f08a6a
commit
bc730807e1
1 changed files with 7 additions and 3 deletions
|
|
@ -1,3 +1,4 @@
|
|||
use chrono_tz::America::New_York;
|
||||
use libseptastic::{direction::Direction, stop_schedule::{Trip, TripTracking}};
|
||||
use std::{cmp::Ordering, collections::BTreeMap};
|
||||
use serde::{Serialize};
|
||||
|
|
@ -62,7 +63,8 @@ pub fn build_timetables(
|
|||
let mut results = Vec::new();
|
||||
|
||||
for direction in directions {
|
||||
let now = chrono::Local::now();
|
||||
let now_utc = chrono::Utc::now();
|
||||
let now = now_utc.with_timezone(&New_York);
|
||||
let naive_time = now.time();
|
||||
let seconds_since_midnight = naive_time.num_seconds_from_midnight();
|
||||
|
||||
|
|
@ -167,10 +169,12 @@ mod filters {
|
|||
let total_minutes = seconds_since_midnight / 60;
|
||||
let (hours, ampm) = {
|
||||
let hrs = total_minutes / 60;
|
||||
if hrs > 12 {
|
||||
if hrs >= 12 {
|
||||
(hrs - 12, "PM")
|
||||
} else {
|
||||
} else if hrs > 0 {
|
||||
(hrs, "AM")
|
||||
} else {
|
||||
(12, "AM")
|
||||
}
|
||||
};
|
||||
let minutes = total_minutes % 60;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue