Created
January 1, 2020 13:22
-
-
Save user24/206ffc0e3e7be92143b9b037ecfb470d 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
// Returns 'yesterday', 'today', 'tomorrow', or else the full day name | |
getDayName(mo) { | |
const daysDifferenceToToday = mo.startOf('day').diff(moment().startOf('day'), 'days'); | |
const differenceMask = { | |
'-1': 'Yesterday', | |
0: 'Today', | |
1: 'Tomorrow' | |
}; | |
return differenceMask[daysDifferenceToToday] || mo.format('dddd'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment