#1
I created a form with a date-time field as follows:



In my config.php, I put in this



At the top of timedate_helper.php is this.



When I run the page with the form on my laptop which has a LAMP server, the date field correctly populates using the format dd-mm-yyyy H:i (eg 25-04-2024, 18:00). But when I upload the codebase to an online server with exactly the same files and database tables, the date-time field fails to populate according to my preferred format and instead defaults to mm/dd/yyyy H:i (eg 04/25/2024, 18:00).

I have tried putting the DEFAULT_DATE_FORMAT constant directly in the page with the form but it does not work. The exact same problem happens on all forms with a date-time field What have I missed?
#2
As an alternative/temporary fix, consider using or

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local

But I will have a look at your issue as well.
#3
Doranov,

I had a look at that page but it has not been helpful unfortunately. It says date appearance depends on locale settings. So I changed the locale settings on the server in /etc/default/locale to match what is on my laptop but when I click on the calendar, it still defaults to for example 07/31/2024 instead of 31-07-2024. Not sure what I missed out.

I am even wondering what is the point of that setting DEFAULT_DATE_FORMAT if it makes no difference. Surely I should be able to get the date format I want without confusing users who may see 08/05/2024 and think it is 8 May 2024 when it is actually 5 August 2024.

This is too fiddly and cumbersome for what should be a straightforward thing to work out of the box.

And the worst part is that I have dates in the database for example 04-08-2024 (4 August 2024) but clicking on the calendar to modify that date shows the month of April instead of August.
#4
I went through the Trongate code and I couldn't find any reason why it wouldn't work on your installation. The Javascript code is using Promises though, so I am guessing that an error occurs after which the default setting '{"default_date_format":"mm/dd/yyyy","default_locale_str":"en-US"}' is returned.

I would suggest the following:
Check the console errors. They are already set in trongate-datetime.js in the async function tgdtFetchDefaultDateFormats(tgdtBaseUrl). Let's see where it goes wrong. We'll take it from there.
Maybe the async function is called in the wrong way. Anyway... no need for second guessing. It's always better to test and verify.

The console should be visible in the Web Developer Tools. In Firefox I can open it with F12. I don't know the shortcut for other browsers, but check the menu for "Tools". Actually, in Chrome it should be Control+Shift+J.

Look for "Error fetching data from:" or "Unexpected HTTP status:".