compare timestamps in javascript

const anyTime = new Date("2017-09-28T22:59:02.448804522Z").getTime();
const currentTime = new Date().getTime();
if(currentTime > anyTime){
    //codes
}

You can parse it to create an instance of Date and use the built-in comparators:

new Date('2017-09-28T22:59:02.448804522Z') > new Date()
// true
new Date('2017-09-28T22:59:02.448804522Z') < new Date()
// false

Conveniently, the date is already in an standard format that Date knows how to parse (looks like ISO8601).


You could also convert it to unix time in milliseconds:

console.log(new Date('2017-09-28T22:59:02.448804522Z').valueOf())

const currentTime = new Date('2017-09-28T22:59:02.448804522Z').valueOf()
    
const expiryTime = new Date('2017-09-29T22:59:02.448804522Z').valueOf()

if (currentTime < expiryTime) {
    console.log('not expired')
}