Skip to content

Instantly share code, notes, and snippets.

View voslartomas's full-sized avatar

Tomáš Voslař voslartomas

View GitHub Profile
const getFirstMondayDate = (daysInMonth, startMonthIndex, firstDayOfTheYearIndex) => {
const numberOfDaysUntillThisMonth = daysInMonth.reduce((acc, curr, i) => i < startMonthIndex ? acc + curr : acc)
let firstDayDate = 1 // first day of the year - only for 1st month
if (startMonthIndex > 0) {
// get date of firstDayOfTheYearIndex of given month (for example - first day of the year is Sunday, we will get date for Sunday for given month)
firstDayDate = 8 - (numberOfDaysUntillThisMonth - (startMonthIndex * 28))
### Keybase proof
I hereby claim:
* I am voslartomas on github.
* I am tvoslar (https://keybase.io/tvoslar) on keybase.
* I have a public key ASCjl0hDHWChA77Hty0qAL6_btcodAvV_7dv0bBAcSyImgo
To claim this, I am signing this object: