Skip to content

Commit

Permalink
Merge pull request #6738 from nextcloud/backport/6736/stable5.1
Browse files Browse the repository at this point in the history
[stable5.1] refactor: don't rely on locale when parsing date
  • Loading branch information
st3iny authored Feb 18, 2025
2 parents 30288a0 + e7a1e6a commit a16f6c2
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/mixins/EditorMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -584,8 +584,13 @@ export default {
* @param {Date} startDate New start date
*/
updateStartDate(startDate) {
const oldStartDate = new Date(this.calendarObjectInstance.startDate)
const combinedStartDate = new Date(startDate.toDateString() + ' ' + oldStartDate.toTimeString())
const combinedStartDate = new Date(startDate)
combinedStartDate.setHours(
this.calendarObjectInstance.startDate.getHours(),
this.calendarObjectInstance.startDate.getMinutes(),
this.calendarObjectInstance.startDate.getSeconds(),
0,
)

this.calendarObjectInstanceStore.changeStartDate({
calendarObjectInstance: this.calendarObjectInstance,
Expand Down Expand Up @@ -627,8 +632,13 @@ export default {
* @param {Date} endDate New end date
*/
updateEndDate(endDate) {
const oldEndDate = new Date(this.calendarObjectInstance.endDate)
const combinedEndDate = new Date(endDate.toDateString() + ' ' + oldEndDate.toTimeString())
const combinedEndDate = new Date(endDate)
combinedEndDate.setHours(
this.calendarObjectInstance.endDate.getHours(),
this.calendarObjectInstance.endDate.getMinutes(),
this.calendarObjectInstance.endDate.getSeconds(),
0,
)

this.calendarObjectInstanceStore.changeEndDate({
calendarObjectInstance: this.calendarObjectInstance,
Expand Down

0 comments on commit a16f6c2

Please sign in to comment.