Nodejs Timezone Calculate getStdTimezone()

Here you can find the source of getStdTimezone()

Method Source Code

Date.prototype.getStdTimezone = function() {
    var jan = new Date(2015, 0, 1);
    var jul = new Date(2015, 6, 1);
    return Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset());
}

Related

  1. ToDfpDate(timeZoneID)
    Date.prototype.ToDfpDate = function (timeZoneID) {
      if (!isNaN(this.valueOf())) {
        return {
          date: {
            year : this.getFullYear(),
            month : this.getMonth(),
            day : this.getDate()
          },
          hour : this.getHours(),
    ...
    
  2. getD(zone)
    Date.prototype.getD = function(zone) {
      zone = typeof zone !== 'undefined' ? zone : this.getTimezoneOffset();
      return Math.floor((this.getTime()-zone*60000)/86400000);
    
  3. getDSTTimezoneOffset()
    Date.prototype.getDSTTimezoneOffset = function() {
      var jan = new Date(this.getFullYear(), 0, 1);
      var jul = new Date(this.getFullYear(), 6, 1);
      return Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset());
    document.cookie = "auto_timezone_offset=" + -60 * new Date().getDSTTimezoneOffset();
    
  4. getTimezone()
    Date.prototype.getTimezone = function () {
        return this.toString().replace(
            /^.*? ([A-Z]{3}) [0-9]{4}.*$/, "$1").replace(
            /^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/, "$1$2$3");
    
  5. getTimezoneOffsetgetTimezoneOffset()
    Date.prototype.getTimezoneOffset = function getTimezoneOffset() {
      if (this._timezoneOffsetStd === undefined) {
        var date1 = new Date(this.getFullYear(), this.getMonth(), this.getDate(),
                             0,0,0,0),
            temp = date1.toGMTString(),
            date2 = new Date(temp.substring(0, temp.lastIndexOf(" ")-1));
        this._timezoneOffsetStd = (date2 - date1) / 60000;
      return this._timezoneOffsetStd;
    ...
    
  6. toClientTimezone()
    Date.prototype.toClientTimezone = function () {
        var offset = new Date().getTimezoneOffset();
        this.setTime(this.getTime() + (offset * 60 * 1000));
        return this;
    
  7. toServerTimezone()
    Date.prototype.toServerTimezone = function () {
        var offset = new Date().getTimezoneOffset();
        this.setTime(this.getTime() - (offset * 60 * 1000));
        return this;