cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Allow specifying a date format for Gantt charts

Allow specifying a date format for Gantt charts

Mousing over a period on a Gantt chart displays the start and end date of that period. However, this date is always displayed in US date format (MM/DD/YYYY), regardless of the date format specified in Global Preferences > Environment.


Either the mouseover dates should use the date format specified in Global Preferences, or it should be possible to change the date format in the settings of the individual Gantt chart.

3 Comments
clair_augsburgerZGWRZ
Collaborator

I had a similar discussion with one of the developpers @jordan.johnson back in April 2018 while testing 18.1 beta before the release. Here are some quotes of the emails I exchanged with Jordan.

Me: When we hover a bar in a gantt chart, why the date and time format is not using the model settings ?

Jordan: Because the charts use Javascript, there is no way to represent a windows setting for formatting dates or times. In windows formatting, you can specify options that don’t exist in other date time formatting libraries. I actually spent a long time figuring out code to convert (acceptably) between the two date-time format systems. Unfortunately, in some languages (like Polish), the names that you need to use for the months or days of the week change based on where they fall in the text. Windows provides multiple versions in that case, but does not provide a way for me to know which one to use.

Instead, I added support to change the format based on the region of your computer. You can find out what region you are by running this code in a script window:

applicationcommand("getlocaleinfo", 0x0000005c)

Then, you can look in the list at MAIN:/project/library/statistics/GenericChart>behavior/eventfunctions/localeInfoD3/timeFormats to see if your region is supported. If not, you are welcome to make a new format string for your region, and we’ll stick it in the software.

In FlexSim 2019, here is the list of time formats in this node:

Image.png

For example on my computer the Windows region is French:

Image.png

And here is how dates are displayed in a Gantt chart:

Image.png

I suggest you to run the script applicationcommand("getlocaleinfo", 0x0000005c) on your computer to check what is your region. And if it is not in the list above, notify @jordan.johnson on this post.

jeremy_r
Not applicable

Thanks Clair, this information is very helpful. My region is en-AU, which it seems does not appear in that list, so it looks like fallbackTimeFormats says to default to en-US in that case.

@jordan.johnson Could you add en-AU to the list of supported date formats? It should use DD/MM/YYYY for date formats, but 12-hour time whenever en-US does. Here's the version I've manually added to my tree.

{"dateTime":"%d/%m/%Y, %X","date":"%d/%m/%Y","time":"%-I:%M:%S %p","periods":["AM","PM"],"days":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"shortDays":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"months":["January","February","March","April","May","June","July","August","September","October","November","December"],"shortMonths":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}

Additionally, I noticed that for some strange reason, en-GB and en-CA have the time between the day/month and the year. Is this intentional? This seems like a very strange convention.
JordanLJohnson
Autodesk

I can add that date format. I'll put it on the dev list. As far as the provided formats for en-GB and en-CA, I pulled those from https://github.com/d3/d3-time-format/tree/master/locale (the charts use the d3 library). The date-time formats do have the time before the year. However, no one in those regions has commented on it, or asked for a change (yet).

Can't find what you're looking for? Ask the community or share your knowledge.

Submit Idea