Skip to content

Instantly share code, notes, and snippets.

@DanWebb
Created July 14, 2017 11:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DanWebb/8f9452391f79b6d6827caae2536829b6 to your computer and use it in GitHub Desktop.
Save DanWebb/8f9452391f79b6d6827caae2536829b6 to your computer and use it in GitHub Desktop.
International date format
export default date => {
const monthNames = [
'Jan',
'Feb',
'Mar',
'Apr',
'May',
'Jun',
'Jul',
'Aug',
'Sep',
'Oct',
'Nov',
'Dec'
];
if (date) {
date = new Date(date);
} else {
date = new Date();
}
return `${date.getDate()} ${monthNames[date.getMonth()]} ${date.getFullYear()}`;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment