Skip to content

Instantly share code, notes, and snippets.

@jhonsore
Last active December 4, 2020 21:39
Show Gist options
  • Save jhonsore/bac1bef18cfab24478960219c0baf6d5 to your computer and use it in GitHub Desktop.
Save jhonsore/bac1bef18cfab24478960219c0baf6d5 to your computer and use it in GitHub Desktop.
function validateDate(y, m, d) {
var month = m-1;
var _date = new Date(y, month, d);
if(isNaN(_date)) return false;
if (_date.getFullYear() != y
|| _date.getMonth() != month
|| _date.getDate() != d) {
return false;
}
return _date;
}
export default validateDate;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment