vue-a11y-calendar
vue-a11y-calendar copied to clipboard
Allow Start of Week to be Designated
I needed to set the start of the week to monday (since this is the standard here), and thought I'd post the changes I made to get this working in case they're usefull to anyone else:
calendar.js:96
const end = day === 0 ? 0 : days.length - day;
calendar.js:120+
const startDay = new Date(Date.parse(current.parsed)).getDay();
const endDay = new Date(Date.parse(`${months[current.month]} ${current.days}, ${current.year}`)).getDay();
current.start = startDay == 0 ? 6 : startDay - 1;
current.end = endDay == 0 ? 6 : endDay - 1;
Haven't been able to test it extensively, but it seems to be working fine.
Please feel free to open up a PR for this with tests so we can get this integrated!
On Oct 18, 2017, at 9:45 AM, Knut Svangstu [email protected] wrote:
I needed to set the start of the week to monday (since this is the standard here), and thought I'd post the changes I made to get this working in case they're usefull to anyone else:
calendars.js:96
const end = day === 0 ? 0 : days.length - day; calendars.js:120+
const startDay = new Date(Date.parse(current.parsed)).getDay(); const endDay = new Date(Date.parse(
${months[current.month]} ${current.days}, ${current.year})).getDay(); current.start = startDay == 0 ? 6 : startDay - 1; current.end = endDay == 0 ? 6 : endDay - 1; Haven't been able to test it extensively, but it seems to be working fine.— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.