JSFiddle - React, Tailwind, and code Playground

by Joe Saad

JavaScript

let token1 = "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJqb2Uuc2FhZEBwd2MuY29tIiwicm9sZXMiOltdLCJleHAiOjE1ODIyNTM2MjksImlhdCI6MTU4MjA3MzYyOX0.JrTM99YF374vIhiEOw6LZlGH3_jgA7TvI7if5-dfgYF4va9J3cjzqjCLNvZypAFNLh4CCjh1iQl_fXte0nqcmw"

let token2 = "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJqb2Uuc2FhZEBwd2MuY29tIiwicm9sZXMiOltdLCJleHAiOjE1ODIyNTM4NDcsImlhdCI6MTU4MjA3Mzg0N30.YLhss5jL6RfhtjaKLbB3NAi00EdktfIoOKfMGigpqpbXU8yjbijtWpEYW-qbFeeqtE2S3S2MkUEWobVL0pMFew"

const token_expiration = new Date("2020-02-21T01:21:18.251Z");
  const currentDate = new Date();
//  let diffInDays = (token_expiration.getTime() - currentDate.getTime()) / (1000 * 3600 * 24);
let diffInDays = (token_expiration.getTime() - currentDate.getTime()) % 60;
  
  alert(diffInDays)
  
  alert(token1.localeCompare(token2))