Nodejs Timezone Offset Get stdTimezoneOffset()

Here you can find the source of stdTimezoneOffset()

Method Source Code

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

Related

  1. stdTimezoneOffset()
    Date.prototype.stdTimezoneOffset = function() {
        var jan = new Date(this.getFullYear(), 0, 1);
        var jul = new Date(this.getFullYear(), 6, 1);
        return Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset());
    Date.prototype.dst = function() {
        return this.getTimezoneOffset() < this.stdTimezoneOffset();
    function get_time_zone_offset() {
    ...
    
  2. stdTimezoneOffset()
    Date.prototype.stdTimezoneOffset = function() {
        const jan = new Date(this.getFullYear(), 0, 1);
        const jul = new Date(this.getFullYear(), 6, 1);
        return Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset());
    };
    
  3. stdTimezoneOffset()
    Date.prototype.stdTimezoneOffset = function() {
      var jan = new Date(this.getFullYear(), 0, 1);
      var jul = new Date(this.getFullYear(), 6, 1);
      return Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset());
    
  4. stdTimezoneOffset()
    var https = require('https'),
      env = require('dotenv').config();
    var wakatimeAPI = process.env.WAKATIME_SECRET_KEY,
      encodedAPI = new Buffer(wakatimeAPI).toString('base64');
    Date.prototype.stdTimezoneOffset = function() {
        var jan = new Date(this.getFullYear(), 0, 1);
        var jul = new Date(this.getFullYear(), 6, 1);
        return Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset());
    Date.prototype.dst = function() {
        return this.getTimezoneOffset() < this.stdTimezoneOffset();
    var formatDate = function(timestamp){
      var pad = function(digit){
        digit = digit+"";
        if(digit.length < 2){
          digit = '0'+digit;
        return digit
      };
      var d = new Date(timestamp),
        year = parseInt(d.getFullYear(),10),
        month = pad(parseInt(d.getMonth(),10)+1),
        date = pad(parseInt(d.getDate(),10));
      return year+'-'+month+'-'+date;
    };