Skip to content
Snippets Groups Projects
Commit 4682abaf authored by jackie / Andrea Ida Malkah Klaura's avatar jackie / Andrea Ida Malkah Klaura
Browse files

FIX: use correct day of week for schedule creation

parent ac7a13bc
No related branches found
No related tags found
No related merge requests found
......@@ -123,6 +123,7 @@ export default {
this.newSchedule.schedule.tend = this.valuePick.tend
this.newSchedule.schedule.until = this.valuePick.until
this.newSchedule.schedule.rrule = this.valuePick.rrule
this.newSchedule.schedule.byweekday = this.getWeekdayFromApiDate(this.valuePick.dstart)
// now generate the URL and POST our new schedule
let uri = process.env.VUE_APP_API_STEERING_SHOWS + this.$parent.shows[this.$parent.currentShow].id + '/schedules/'
axios.post(uri, this.newSchedule, {
......@@ -199,7 +200,7 @@ export default {
this.newSchedule = {
schedule: {
rrule: 1,
show: 21,
show: 0,
byweekday: 0,
dstart: dstart,
tstart: tstart,
......
......@@ -34,6 +34,13 @@ export default {
var d = new Date(date)
return d.getFullYear() + '-' + leadingZero(d.getMonth() + 1) + '-' + leadingZero(d.getDate())
},
getWeekdayFromApiDate: function (date) {
let d = new Date(date)
let w = d.getDay()
// Date.getDay() returns 0 for Sundays, but for our APIs we need 0 for Mondays
if (w === 0) { return 6 }
else { return w - 1 }
},
prettyDate: function (date) {
var d = new Date(date)
var dstring = ''
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment