Skip to content

Commit

Permalink
Merge pull request #796 from culturecreates/hotfix/issue-772
Browse files Browse the repository at this point in the history
fix: fixed local timezone being added single date
  • Loading branch information
AbhishekPAnil authored Nov 17, 2023
2 parents 61ff4c4 + fbd0c68 commit facb5f4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/pages/Dashboard/AddEvent/AddEvent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,11 @@ function AddEvent() {
let dynamicAdminOnlyFields = requiredFields?.adminOnlyFields?.dynamicFields ?? [];
const calendarContentLanguage = currentCalendarData?.contentLanguage;
const dateTimeConverter = (date, time) => {
let dateSelected = moment.tz(date, eventData?.scheduleTimezone ?? 'Canada/Eastern').format('DD-MM-YYYY');
let timeSelected = moment.tz(time, eventData?.scheduleTimezone ?? 'Canada/Eastern').format('hh:mm:ss a');
let dateTime = moment(dateSelected + ' ' + timeSelected, 'DD-MM-YYYY HH:mm a');
return moment(dateTime).toISOString();
let dateSelected = date.format('DD-MM-YYYY');
let timeSelected = time.format('hh:mm:ss a');
// Combine date and time and explicitly set the timezone to 'Canada/Eastern'
let dateTime = moment.tz(dateSelected + ' ' + timeSelected, 'DD-MM-YYYY HH:mm a', 'Canada/Eastern');
return dateTime.toISOString();
};

const calendar = user?.roles.filter((calendar) => {
Expand Down

0 comments on commit facb5f4

Please sign in to comment.