Created
October 18, 2018 13:42
-
-
Save garenyondem/e021f4fb02fc40a2453a9f8b695bc2a3 to your computer and use it in GitHub Desktop.
Mother's day & father's day helper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| function getMothersDay(year) { | |
| // Earliest possible Mothers day | |
| var date = new Date(year, 4, 7); | |
| date.setDate(7 + (7 - date.getDay())); | |
| return date; | |
| } | |
| function getFathersDay(year) { | |
| // Earliest possible Fathers day | |
| var date = new Date(year, 5, 14); | |
| date.setDate(7 + (14 - date.getDay())); | |
| return date; | |
| } | |
| module.exports = { | |
| getFathersDay: getFathersDay, | |
| getMothersDay: getMothersDay | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment