Skip to content

Commit

Permalink
Merge pull request #9 from he1senbrg/master
Browse files Browse the repository at this point in the history
Fix: Change timezone to Asia/Kolkata
  • Loading branch information
Wreck-X authored Oct 3, 2024
2 parents e5ce7a8 + e109493 commit b0fa85a
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 8 deletions.
51 changes: 51 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ sqlx = { version = "0.7.1", features = ["chrono"] }
tokio = "1.28.2"
hmac = "0.12.1"
sha2 = "0.10.8"
hex = "0.4.3"
hex = "0.4.3"
chrono-tz = "0.10.0"
8 changes: 3 additions & 5 deletions src/graphql/mutations.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use async_graphql::{Context, Object};
use ::chrono::Local;
use chrono::{NaiveDate, NaiveTime};
use chrono_tz::Asia::Kolkata;
use sqlx::PgPool;
use sqlx::types::chrono;
use sqlx::types::chrono;
use std::sync::Arc;
use hmac::{Hmac,Mac};
use sha2::Sha256;
Expand Down Expand Up @@ -113,10 +114,7 @@ impl MutationRoot {
return Err(sqlx::Error::Protocol("HMAC verification failed".into()));
}




let current_time = Local::now().time();
let current_time = Local::now().with_timezone(&Kolkata).time();

let attendance = sqlx::query_as::<_, Attendance>(
"
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::time::Duration;
use async_graphql_axum::GraphQL;
use axum::{routing::get, Router};
use chrono::{ Local, NaiveTime};

use chrono_tz::Asia::Kolkata;
use db::member::Member;
use sqlx::PgPool;
use async_graphql::{ Schema, EmptySubscription};
Expand Down Expand Up @@ -63,7 +63,7 @@ async fn scheduled_task(pool: Arc<PgPool>) {

match members {
Ok(members) => {
let today = Local::now().naive_local();
let today = Local::now().with_timezone(&Kolkata);

for member in members {
let timein = NaiveTime::from_hms_opt(0, 0, 0);
Expand Down

0 comments on commit b0fa85a

Please sign in to comment.