Created
August 5, 2020 21:01
-
-
Save danielmascena/2c3a42a10267e6294f449a4f9d8359b9 to your computer and use it in GitHub Desktop.
A simple helper method to get the days of week
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
(function(Date) { | |
if (new RegExp(Date.name).test(Object.prototype.toString.call(new Date)) && !Date.prototype.getWeekDayString) { | |
const WEEKDAYS = ["SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY"]; | |
Date.prototype.getWeekDayString = function() { | |
return WEEKDAYS[this.getDay()]; | |
}; | |
} | |
})(globalThis && globalThis.Date || (window && window.Date || global && global.Date)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment