Skip to content

Instantly share code, notes, and snippets.

@pinguxx
Created April 2, 2019 03:35
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 pinguxx/12c8f2a3e8c8261b0b849744cb379389 to your computer and use it in GitHub Desktop.
Save pinguxx/12c8f2a3e8c8261b0b849744cb379389 to your computer and use it in GitHub Desktop.
hyper.define('date', (date) => {
let formatted = '',
newdate = date;
if (date) {
if (typeof newdate.getMonth !== 'function') {
newdate = new Date(date);
}
if (typeof newdate.getMonth === 'function') {
formatted = `
${newdate.getMonth() + 1}/${newdate.getDate()}/${newdate.getFullYear()}
`;
}
}
return {
text: formatted
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment