timekeeper

My first (abandoned unfinished) web application for time tracking
git clone git://jacobedwards.org/timekeeper
Log | Files | Refs | README

localize.js (605B)


      1 function localize_time(time) {
      2 	let date = new Date(Date.parse(time.dateTime))
      3 	let options = {
      4 		/* "hour12": false, */
      5 		"hour": "2-digit",
      6 		"minute": "2-digit"
      7 	}
      8 	time.textContent = date.toLocaleTimeString([], options)
      9 }
     10 
     11 function localize_date(time) {
     12 	let date = new Date(Date.parse(time.textContent))
     13 	let options = {
     14 		"year": "numeric",
     15 		"month": "2-digit",
     16 		"day": "2-digit"
     17 	}
     18 	time.textContent = date.toLocaleDateString([], options)
     19 }
     20 
     21 document.querySelectorAll("td:not(:nth-child(6))>time").forEach(localize_time)
     22 document.querySelectorAll("th[scope=\"row\"]>time").forEach(localize_date)