Skip to content

Instantly share code, notes, and snippets.

@caiogranero
Created June 22, 2018 00:18
Show Gist options
  • Save caiogranero/ad139d80aabc4c0d0684af54f7594157 to your computer and use it in GitHub Desktop.
Save caiogranero/ad139d80aabc4c0d0684af54f7594157 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 29:10:10' }
]
const dateFormat = 'DD/MM/YYYY HH:mm:ss'
const allDateIsValid = () => {
return characters.every(character => {
return moment(character.appearAt, dateFormat, true).isValid()
})
}
// false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment