I have some date fields in my application (backed by rails) and my locale is pt-BR (dd/mm/yyyy).
I know that some browsers (e.g. Chrome) support input type=date and in these browsers I would like to use the native datepicker, and the format (presentation format) of date is shown accordingly with the browser locale settings, although the field value (wire format) still in ISO yyyy-mm-dd format.
In other browsers that do not support it (e.g. Firefox) I am using a datepicker provided by javascript when the user focus the field, and the date is shown with my default pt-BR format (presentation format equals to wire format, localized).
I am switching between these two types via Modernizr.
However, the value (wire-format) submitted to the server is different, depending on the approach and I need to receive the value in my server equal, independent of user's browser.
How do I handle this situation?
Should I ignore input type date and use only one approach (change the type to text)?
Or should I format the value, before submitting, via javascript, to 'delocalize' the value?
Thanks in advance.