Select to view content in your preferred language

Dateformat on infowindow

2623
14
01-26-2018 05:07 AM
EvelynHernandez
Frequent Contributor

Hello, I have the following question.

How can i set up a dateformat for a infowindow? Right now my problem is the infowindow is showing a incorrect timezone, (-3 hr to my current timezone), so i need to fix it.

Here is my code:

let chInfoTemp= new InfoTemplate();
 chInfoTemp.setTitle("<b>Current:</b>");
 
 let chInfoContent =
 "<div style=padding-top: 10px;><b>Starting: </b> ${initial_date:DateFormat(datePattern:'d MMMM yyyy, HH:mm:ss.', selector:'date')}<br></div>"+
 "<div style=padding-top: 10px;><b>Final:</b> ${er:DateFormat(datePattern:'d MMMM yyyy, HH:mm:ss.', selector:'date')}<br></div>";
 chInfoTemp.setContent(chInfoContent);
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Thanks in advice!

0 Kudos
14 Replies
DavidColey
MVP Regular Contributor

I think so yes, I believe at the time we were accounting for EDT vs GMT and yes I think we required

"dojo/date/locale" aliased as locale

0 Kudos
EvelynHernandez
Frequent Contributor

Right now if i dont place a dateFormat, they will show the correct datetime on the infoTemplate each time i click a feature. The thing is the format is in English, and i really need to have  it in Spanish and in this way : d/MM/yyyy HH:MM:ss.

Do u know any fix for that? Because when i use the dateFormatter like this example:

${Date_:DateFormat(datePattern:'d/MM/yyyy HH:MM:ss', selector:'date')}

It will change the format to the desired one in spanish, but it will drop -3hrs to the current date.

0 Kudos
DavidColey
MVP Regular Contributor

I don't, but I'd say go into the dojoToolkit:

dojo/date/locale::format() — The Dojo Toolkit - Reference Guide 

and see what you can come up with

0 Kudos
EvelynHernandez
Frequent Contributor

Yea i read all of those already and i have tried but nothing came out of that XD

0 Kudos
DavidColey
MVP Regular Contributor

yeah sorry i don't how to account for that then, there's probably a way to set the constant value to account for that but i don't know what that would be