Hey everyone! I'm an Associate Software Developer with two years of experience. My main focus is full stack applications using .NET, C#, Angular, and T-SQL.
I’m currently learning...I'm currently learning React and focusing on re-strengthening my foundation in HTML, JavaScript, and CSS.
Latest solutions
Advice generator with Express proxy server to call api
#express#node#react#vite#fetchPSubmitted 4 months ago
Latest comments
- @demi05P@CMac450
I made an array to hold known leap years starting from 1952 up until 2020. If the value of the year input was included in the leapYears array, the month value was 2, and the day value was greater than 29, then the entire date would be flagged as invalid.
If the 'years' value was not included in 'leapYears', the 'month' value was 2, and the 'day' value was greater than 28, then the entire date would be flagged as invalid as well.
const leapYears = [1952, 1956, 1960, 1964, 1968, 1972, 1976, 1980, 1984, 1988, 1992, 1996, 2000, 2004, 2008, 2012, 2016, 2020]; let isDateValid = false; let day = userInputDay; let month = userInputMonth; let year = userInputYear; if(leapYears.includes(parseInt(year)) && parseInt(month) === 2 && parseInt(day) > 29 { isDateValid = false; } else if(!leapYears.includes(parseInt(year)) && parseInt(month) === 2 && parseInt(day) > 28 { isDateValid = false; } //"isDateValid = false" = show date error
Let me know if this helped you in any way. Great work with your solution!
Marked as helpful