If your question about <input type="date">
field, here is script for getting filed value=""
attribute:
(new Date()).toISOString().split('T')[0]
You can use the Intl object (ecma-402) to get data-date-pattern=""
:
(new Intl.DateTimeFormat()).resolved.pattern // "M/d/y" for "en-US" in Google Chrome
And finnaly, to format date in current l10n, data-date=""
:
(new Intl.DateTimeFormat()).format(new Date());
Polyfill: https://github.com/andyearnshaw/Intl.js/issues/129