diff --git a/js/main.js b/js/main.js index a2be717..c98279c 100644 --- a/js/main.js +++ b/js/main.js @@ -51,7 +51,7 @@ preprocessor.load(function(data) { var raceD = slyelement.curRaces[race]; $("#courseSelection").append("
  • " + "" + raceD.raceInfo.name +""+ - "
    " + raceD.raceInfo.date.toLocaleDateString("de-DE") + "
  • "); + "
    " + germanDateString(raceD.raceInfo.date) + ""); $("#courseSelection li").click(function(event) { var raceI = event.currentTarget.attributes.data.value; diff --git a/js/util.js b/js/util.js index 0f72322..952b931 100644 --- a/js/util.js +++ b/js/util.js @@ -5,6 +5,21 @@ * stuff not related to what this project actually does. */ +function germanDateString(inputDate) { + var dateString = ""; + var d = inputDate.getDate(); + var m = inputDate.getMonth()+1; // Don't ask. + var y = inputDate.getFullYear(); + if(d < 10) dateString += "0"; + dateString += d.toString(); + dateString += "."; + if(m < 10) dateString += "0"; + dateString += m.toString(); + dateString += "."; + dateString += y.toString(); + return dateString; +} + /* Define global structure for the loading dialog */ var loadingDialog = { id: "#loading-dialog", @@ -156,7 +171,7 @@ function renderRaceInfoBox(race) { content = "

    "+raceInfo.name+" "+raceInfo.date.getFullYear()+"

    "; content += "
    "+circuit.name+" ("+circuit.location+", "+circuit.country+")
    "; - content += "
    "+raceInfo.date.toLocaleDateString("de-DE")+"
    " + content += "
    "+germanDateString(raceInfo.date)+"
    " content += "
    "; content += "See Race on Wikipedia "; content += "See Circuit on Wikipedia "; @@ -220,7 +235,7 @@ function renderDriverInfoBox(race) { content += ""+driver.forename+""; content += ""+driver.surname+""; content += ""+driver.nationality+""; - content += ""+driver.dob.toLocaleDateString("de-DE")+""; + content += ""+germanDateString(driver.dob)+""; content += "Wikipedia"; content += ""; }