Commit 110ab730 authored by Nikita Sjölander's avatar Nikita Sjölander
Browse files

Corrected a problem where workouts would be scheduled on the day before. Timezone issue

parent b2341cc9
No preview for this file type
from flask import Flask, Blueprint, jsonify, request, send_from_directory
from flask_mysqldb import MySQL
#from flask_mysqldb import MySQL
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import text
from datetime import timedelta
......
......@@ -31,14 +31,14 @@ changeCurrentDay = (day) => {
currentDay: newDate,
isModalOpen: true,
},
() => this.fetchWorkoutsForDate(newDate.toISOString().split('T')[0])
() => this.fetchWorkoutsForDate(newDate.toLocaleDateString('sv-SE'))
);
};
componentDidMount() {
// Fetch workouts for today on load
const today = new Date().toISOString().split('T')[0];
const today = new Date().toLocaleDateString('sv-SE');
this.fetchWorkoutsForDate(today);
}
......@@ -52,7 +52,7 @@ submitWorkout = async () => {
const workoutData = {
user_id: 1,
activity_id: 1,
schedule_date: currentDay.toISOString().split('T')[0],
schedule_date: currentDay.toLocaleDateString('sv-SE'),
start_time: startTime,
end_time: endTime,
activity_name: workout
......@@ -71,7 +71,7 @@ submitWorkout = async () => {
const result = await response.json();
console.log('Workout saved:', result);
this.fetchWorkoutsForDate(currentDay.toISOString().split('T')[0]);
this.fetchWorkoutsForDate(currentDay.toLocaleDateString('sv-SE'));
} catch (error) {
console.error('Error saving workout:', error);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment