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
...@@ -123,6 +123,7 @@ export default { ...@@ -123,6 +123,7 @@ export default {
this.newSchedule.schedule.tend = this.valuePick.tend this.newSchedule.schedule.tend = this.valuePick.tend
this.newSchedule.schedule.until = this.valuePick.until this.newSchedule.schedule.until = this.valuePick.until
this.newSchedule.schedule.rrule = this.valuePick.rrule 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 // 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/' let uri = process.env.VUE_APP_API_STEERING_SHOWS + this.$parent.shows[this.$parent.currentShow].id + '/schedules/'
axios.post(uri, this.newSchedule, { axios.post(uri, this.newSchedule, {
...@@ -199,7 +200,7 @@ export default { ...@@ -199,7 +200,7 @@ export default {
this.newSchedule = { this.newSchedule = {
schedule: { schedule: {
rrule: 1, rrule: 1,
show: 21, show: 0,
byweekday: 0, byweekday: 0,
dstart: dstart, dstart: dstart,
tstart: tstart, tstart: tstart,
......
...@@ -34,6 +34,13 @@ export default { ...@@ -34,6 +34,13 @@ export default {
var d = new Date(date) var d = new Date(date)
return d.getFullYear() + '-' + leadingZero(d.getMonth() + 1) + '-' + leadingZero(d.getDate()) 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) { prettyDate: function (date) {
var d = new Date(date) var d = new Date(date)
var dstring = '' var dstring = ''
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment