vue-a11y-calendar icon indicating copy to clipboard operation
vue-a11y-calendar copied to clipboard

Allow Start of Week to be Designated

Open Snugug opened this issue 8 years ago • 2 comments

Snugug avatar Oct 02 '17 15:10 Snugug

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.

KnutSv avatar Oct 18 '17 14:10 KnutSv

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.

Snugug avatar Oct 18 '17 16:10 Snugug