Skip to content

Commit

Permalink
872: Fixed handling of time zones?
Browse files Browse the repository at this point in the history
  • Loading branch information
rimi-itk committed Mar 5, 2024
1 parent a85e5b3 commit 6576206
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 21 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down
10 changes: 1 addition & 9 deletions src/components/util/schedule/schedule-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
13 changes: 3 additions & 10 deletions src/components/util/schedule/schedule.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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") : "";
};

/**
Expand Down

0 comments on commit 6576206

Please sign in to comment.