Skip to content

Instantly share code, notes, and snippets.

@caiogranero
Created June 22, 2018 00:20
Show Gist options
  • Save caiogranero/d221dd55d6834fdd59d3ec6c39311fd2 to your computer and use it in GitHub Desktop.
Save caiogranero/d221dd55d6834fdd59d3ec6c39311fd2 to your computer and use it in GitHub Desktop.
const characters = [
{ name: 'Professor', appearAt: '10/05/2017 10:10:10'},
{ name: 'Nairobi', appearAt: '10/05/2017 12:10:10' },
{ name: 'Tókyo', appearAt: '10/06/2017 07:10:10' },
{ name: 'Rio', appearAt: '10/06/2017 09:10:10' },
{ name: 'Denver', appearAt: '10/07/2018 11:10:10' },
{ name: 'Berlim', appearAt: '10/07/2018 17:10:10' },
{ name: 'Helsinque', appearAt: '15/04/2017 12:10:10' },
{ name: 'Moscou', appearAt: '15/04/2017 12:10:10' },
{ name: 'Raquel Murillo', appearAt: '10/09/2020 25:10:10' }
]
const dateFormat = 'DD/MM/YYYY HH:mm:ss'
const someDateIsValid = () => {
return characters.some(character => {
return moment(character.appearAt, dateFormat, true).isValid()
})
}
// true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment