I assume you want JS, despite the example being in gods know what
const isLeapYearHelper = (year) => (year % 400 == 0 ? true : year % 100 == 0 ? false : year % 4 == 0 ? true : false)
const isLeapYear = (str) => {
const date = new Date(str)
const isValid = !isNaN(date.getTime())
return isValid ? isLeapYearHelper(date.getFullYear()) ? `${date.getFullYear()} is a leap year` : `${date.getFullYear()} is a not leap year` : 'Invalid Date'
}
console.log(isLeapYear('2020-01-01 00:00:00777'))
console.log(isLeapYear('2021-01-15 13:00:00'))
console.log(isLeapYear('2200-01-15 13:00:00'))
console.log(isLeapYear('2020-01-15 13:00:00'))
console.log(isLeapYear(1213131313135465656654564646542132132131))
console.log(isLeapYear(1213131313))
3
solved Difficult function isLeapYear [closed]