I'm writing the script to check validity of tickets and canno't compare validity of ticket using Date
. As I'm reading documentation Date object should be able to be compared to another Date object.
Here's an example of code you can use to test.
const today = new Date()
const date = '12/15/2022, 5:20:00 PM'
console.log(today.toLocaleString({
timeZone: "Europe/Kyiv",
}))
console.log(date)
console.log(date >= today)
//it should return **false** if ticket is expired and **true** if it's still valid (which is in this case)