Skip to content

Instantly share code, notes, and snippets.

@jethrolarson
Created December 2, 2017 00:57
Show Gist options
  • Save jethrolarson/99ca3c02c0f8c5de85b10843778a580c to your computer and use it in GitHub Desktop.
Save jethrolarson/99ca3c02c0f8c5de85b10843778a580c to your computer and use it in GitHub Desktop.
How moment.js parses falsy values
moment(0) // epoc
moment(undefined) // Now
moment(null) // Invalid Date
moment(false) // throw warning, Invalid date
moment(void 0) // Now
moment('') // Invlid Date
moment([]) // Now
moment({}) // Now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment