Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Change timezone to Asia/Kolkata #9

Merged
merged 3 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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