diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..f84a7903 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +indent_style = space +indent_size = 2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bcc6f5c..382f164e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +- [#232](https://github.com/os2display/display-admin-client/pull/232) + - Fixed time zone issue in playlist schedules. - [#231](https://github.com/os2display/display-admin-client/pull/231) - Fixed post body of activation POST request. - [#230](https://github.com/os2display/display-admin-client/pull/230) @@ -71,8 +73,8 @@ All notable changes to this project will be documented in this file. - [#205](https://github.com/os2display/display-admin-client/pull/205) - Setup separate image builds for itkdev and os2display - [#204](https://github.com/os2display/display-admin-client/pull/204) - - Change docker image name from `os2display/os2display-admin-client` - to `os2display/display-admin-client` to match image name and + - Change docker image name from `os2display/os2display-admin-client` + to `os2display/display-admin-client` to match image name and repository name - [#200](https://github.com/os2display/display-admin-client/pull/200) - Update docker build to publish to "os2display" org on docker hub. diff --git a/src/components/util/schedule/schedule-util.js b/src/components/util/schedule/schedule-util.js index 7b3b75d7..73138a4e 100644 --- a/src/components/util/schedule/schedule-util.js +++ b/src/components/util/schedule/schedule-util.js @@ -56,15 +56,7 @@ const createNewSchedule = () => { id: ulid(nowTimestamp), duration: 60 * 60 * 24, // Default one day. freq: RRule.WEEKLY, - dtstart: new Date( - Date.UTC( - now.getFullYear(), - now.getMonth(), - now.getDate(), - now.getHours(), - now.getMinutes() - ) - ), + dtstart: new Date(), until: null, wkst: RRule.MO, byhour: null, diff --git a/src/components/util/schedule/schedule.jsx b/src/components/util/schedule/schedule.jsx index 2df3f84c..731ff420 100644 --- a/src/components/util/schedule/schedule.jsx +++ b/src/components/util/schedule/schedule.jsx @@ -119,16 +119,9 @@ function Schedule({ schedules, onChange }) { * @param {object} target - Input target. */ const setDateValue = (scheduleId, target) => { - const date = new Date(target.value); - + const date = target.valueAsDate; const scheduleDate = new Date( - Date.UTC( - date.getFullYear(), - date.getMonth(), - date.getDate(), - date.getHours(), - date.getMinutes() - ) + date.getTime() + 60 * 1000 * date.getTimezoneOffset() ); changeSchedule(scheduleId, target.id, scheduleDate); @@ -141,7 +134,7 @@ function Schedule({ schedules, onChange }) { * @returns {string} - The date formatted for datetime-local. */ const getDateValue = (date) => { - return date ? dayjs(date).utc().format("YYYY-MM-DDTHH:mm") : ""; + return date ? dayjs(date).format("YYYY-MM-DDTHH:mm") : ""; }; /**