title: comapre javascript toUTCString() with UTC date time
body: <p>From Authentication API along with token i am getting its expiry date time which is in UTC</p>
  <p>I am using npm jwt-decode package to extract the info</p>
  <pre><code>private setToken(value: string) {
      this._token = value;
      var decoded = jwt_decode(value);
      this._expiry = new Date(decoded['expiry']);
  }
  </code></pre>
  <p>To check if token expired i compare it with current UTC dat time</p>
  <pre><code>isTokenExpired() {
      var currentUTC = new Date().toUTCString() as any;
      var flag = this._expiry &lt; (currentUTC as Date);
      if (flag)
          return true;
      else
          return false;
  }
  </code></pre>
  <p>but new Date().toUTCString() gives strig instaed of date which always retuen false when compare with date object</p>
  <p>I tried to convert it to date but after conversion it show date as per browser local time zone instead of actual utc date time</p>
  <pre><code>    console.log('current UTC : '+ currentUTC);
      console.log('expiry UTC : '+ this._expiry);
      console.log('utc string to UTC Date : ' + this.createDateUTC(currentUTC));
      console.log(new Date(Date.parse(currentUTC as string)));
      console.log(this._expiry &lt; (currentUTC as Date));
  
  createDateUTC(dateUTC) {
      return new Date(dateUTC + &quot;Z&quot;);
  }
  </code></pre>
  <p>output is as follow</p>
  <pre><code>current UTC : Fri, 02 Sep 2022 02:32:21 GMT
  expiry UTC : Fri Sep 02 2022 03:32:08 GMT+0530 (India Standard Time)
  utc string to UTC Date : Invalid Date
  Fri Sep 02 2022 08:02:21 GMT+0530 (India Standard Time)
  </code></pre>
  <p>Current UTC is correct</p>
  <p>expiry UTC is correct , Current UTC + 1 hours as expiry time returned from api</p>
  <p>third one is converted to date which is invalid date , Ref : <a href="https://stackoverflow.com/questions/69397628/convert-date-time-string-to-utc-date-in-javascript">stack overflow Post by Killer</a></p>
  <p>fourth one , tried to parse but it after parsing its local time. UTC time lost.</p>
  <p>Any idea how to convert UTC string to date object without loosing its actual value, or any other approach to get current UTC date time</p>
  <p>Update 1 :</p>
  <p>After refresh</p>
  <blockquote>
  <p>this._expiry = new Date(decoded['expiry'])</p>
  </blockquote>
  <p>inside setTokn() method also lost UTC date time and convert it as per local time</p>
  <p>Update 2:</p>
  <p>Tried code by &quot;HsuTingHuan&quot; but got same result. Issue persist
  <a href="https://i.stack.imgur.com/YVxW8.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YVxW8.jpg" alt="enter image description here" /></a></p>