I've been rewriting a Visualforce page to use SLDS styling. Part of this requires rewriting dynamics DateTIme fields to SLDS Date time picker. This therefore means writing the Date part of the DateTime field to the Date input field and the Time part of the DateTime field to the Time input field. What I have done and it works ok is the following.
I've created a hidden Apex:InputField to bind the original Visualforce field to the controller without changing any Apex. When my page loads I read the value of each hidden Apex:InputField field and write the date and time parts to HTML input fields for my Date and Time SLDS pickers.
When the Date is changed via the date picker (or manually) I Rewrite the Date/Time value to hidden Apex:InputField and similarly when the time input changes I rewrite the Date/Time value again also to hidden Apex:InputField. This all binds back to the controller ok and works well. There can be many dynamic Apex:Input fields on the page in my Apex:Iteration but this all works ok. One issue which has arisen though and I've been trying to determine a solution. If the locale changes (I developed this in en_US), the format of how I write my Date/Time to my hidden Apex:Inout field causes issues. If you look at following the Date and time Format's listed must be respected and the value written to the Apex:Input field must respect this.
However while I know of some locale's that will be used I'd prefer not to have to manually check for a few of these in my code and alter how this is written accordingly. I presumed I could use supported dateTime formats but I cannot get any of them to work. I've tried:
YYYY-MM-DDThh:mm:ss+hh:mm YYYY-MM-DDThh:mm:ss-hh:mm YYYY-MM-DDThh:mm:ssZ
I've been using moment js and tried to use it for formatting https://momentjs.com/
IN summary of all this, Is there no standard format I can use for my Apex:Input field that will work regardless of the locale I'm in?