fix timezone conversion when fetching booking reservations

This commit is contained in:
Bilal Catic
2019-06-24 22:33:10 +02:00
parent 7f0042633c
commit e03f634aff

View File

@@ -41,7 +41,7 @@ const getAllFinishedBookings = () => {
const filters = {
canceled: false,
end: {
[Op.lt]: moment.tz('UTC')
[Op.lt]: moment.utc().toISOString()
}
};
@@ -56,8 +56,8 @@ const getAllFinishedBookings = () => {
const getFirstNextBooking = (reservation) => {
return new Promise ((resolve, reject) => {
const {resourceId, start, timezone} = reservation;
const endOfTheDay = moment.tz(start, timezone).endOf('Day').toISOString();
const { resourceId, start } = reservation;
const endOfTheDay = moment.utc(start).endOf('Day').toISOString();
const attributes = ['reservationId', 'memberId', 'resourceId', 'start', 'end', 'timezone'];
const filters = {
@@ -90,8 +90,8 @@ const getFirstNextBooking = (reservation) => {
const getFirstPreviousBooking = (reservation) => {
return new Promise ((resolve, reject) => {
const {resourceId, start, timezone} = reservation;
const startOfTheDay = moment.tz(start, timezone).startOf('Day').toISOString();
const { resourceId, start } = reservation;
const startOfTheDay = moment.utc(start).startOf('Day').toISOString();
const attributes = ['reservationId', 'memberId', 'resourceId', 'start', 'end', 'timezone'];
const filters = {