Skip to content

Instantly share code, notes, and snippets.

@chris-martin
Created March 12, 2016 01:54
Show Gist options
  • Save chris-martin/eeaa7444bcdd3cf0c3e0 to your computer and use it in GitHub Desktop.
Save chris-martin/eeaa7444bcdd3cf0c3e0 to your computer and use it in GitHub Desktop.
/**
* Moment.js doesn't have the particular locale-aware format string
* that we need here, so this is an ugly workaround to derive it
* from some related format strings that it does have.
* https://github.com/moment/moment/issues/2505
*/
function getMomentDateFormat() {
var localeData = moment.localeData(moment.locale()),
llll = localeData.longDateFormat('LLLL'),
lll = localeData.longDateFormat('LLL'),
ll = localeData.longDateFormat('LL');
return llll.replace(lll.replace(ll, ''), '');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment