Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

86
Views
How compose a JS basing a lang variable for just one attribute

First of all I know there are alternative ways of printing current date, etc. But I would like to use this JS anyway.

I would like the following to print the date using specific month in own language.

Can anybody please help me making this script work correctly so it prints the correct date basing on visitors browser language?

function getDate(){
var monthNames = 
  let phrase;
  if (italian) {phrase = phrases.italian; }
  else if (french) {phrase = phrases.french; }
  else if (german) {phrase = phrases.german; }
  else {phrase = phrases.english; }
  el.innerHTML = `${phrase}`;  };
  modifyElHTML('MyMonth', {

italian: ("Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"]);

french: ("Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"]);

german: ("Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"]);

english: ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]);

var today = new Date(); var dd = today.getDate(); var mm = today.getMonth(); var minutes = today.getMinutes();
if (minutes < 10)  minutes = '0'+minutes; var hour = today.getHours(); var yyyy = today.getFullYear();
if(dd<10){dd='0'+dd} var today = dd+'  '+ monthNames[mm]+'  '+yyyy+' - '+hour+':'+minutes; return today;}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!