Design comparison
SolutionDesign
Solution retrospective
Can anyone tell me if this logic is right, I have some doubts đ¤. JS:
const day = document.getElementById('day')
const month = document.getElementById('month')
const year = document.getElementById('year')
const amont_of_days = new Date(parseInt(year.value), parseInt(month.value), 0).getDate()
let total_years = parseInt(current_year - year.value)
let total_months = 12 - parseInt(month.value)
let total_days = parseInt(day.value - current_day)
if(current_month < month.value){
total_years -= 1
}
if(current_day > day.value){
total_months += 1
}
if(total_days < -1){
total_days = total_days * -1
}
Community feedback
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord