Created
February 28, 2020 15:40
-
-
Save kdssoftware/d9340c58178b1b0adc7d10c6e90bfaf3 to your computer and use it in GitHub Desktop.
adds the day of week to each html selector, using european date format DD-MM-YYYY
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
function addDayName (_dateString) { | |
let dateString = _dateString.toString(); | |
let dagen = ["Zondag","Maandag","Dinsdag","Woensdag","Donderdag","Vrijdag","Zaterdag"]; | |
let arrayOfDate = dateString.split("-"); // symbol in date | |
let swappedDate= arrayOfDate[1] + "/" + arrayOfDate[0] + "/" + arrayOfDate[2]; | |
let date = new Date(Date.parse(swappedDate)); | |
return dagen[date.getDay()]+" "+dateString; | |
} | |
function changeAllOnSelector(selector){ | |
$(document).ready(function() { | |
$(selector).each(function(){ | |
$(this).text(voegDagToe($(this).text())); | |
}); | |
}) | |
} | |
changeAllOnSelector('td.date'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment