Created
January 31, 2018 12:40
-
-
Save mrpapercut/807d3771ec05ac63a5f277469923344c to your computer and use it in GitHub Desktop.
This file contains 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
import moment from 'moment-timezone'; | |
const isFridayFiveOClock = () => { | |
const curtime = moment().tz('Europe/Amsterdam'); | |
const nextFriday = moment().tz('Europe/Amsterdam').day(5).hour(17).minute(0).seconds(0); | |
if (moment().format('d') >= 5) { | |
nextFriday.add(1, 'week'); | |
} | |
if (curtime.format('d') === 5) { | |
if (curtime.format('H') >= 17) { | |
return ':clock5: => :beers:'; | |
} else { | |
return `:no_entry_sign::beer: Almost there, 17:00 is ${curtime.to(nextFriday)}`; | |
} | |
} else { | |
return `Have patience, Friday is ${curtime.to(nextFriday)}`; | |
} | |
}; | |
export default isFridayFiveOClock; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment