Commits

Chris Leonello committed d903bf3

Removed utcOffset property which incorrectly
would always get offset for current time.
Added getUtcOffset() method.

Comments (0)

Files changed (1)

     
         this.syntax = jsDate.config.syntax;
         this._type = "jsDate";
-        this.utcOffset = new Date().getTimezoneOffset() * 60000;
         this.proxy = new Date();
         this.options = {};
         this.locale = jsDate.regional.getLocale();
                 for ( var i=0; i<arguments.length; i++ ) {
                     a.push(arguments[i]);
                 }
-                this.proxy = new Date( this.utcOffset );
+                // this should be the current date/time?
+                this.proxy = new Date();
                 this.proxy.setFullYear.apply( this.proxy, a.slice(0,3) );
                 if ( a.slice(3).length ) {
                     this.proxy.setHours.apply( this.proxy, a.slice(3) );
     };
 
     /**
+     * Get the UTC TimeZone Offset of this date in milliseconds.
+     *
+     * @returns {Number}
+     */
+
+    jsDate.prototype.getUtcOffset = function() {
+        return this.proxy.getTimezoneOffset() * 60000;
+    };
+
+    /**
      * Find the difference between this jsDate and another date.
      * 
      * @param {String| Number| Array| jsDate&nbsp;Object| Date&nbsp;Object} dateObj
                 for ( var i=0; i<arguments.length; i++ ) {
                     a.push(arguments[i]);
                 }
-                this.proxy = new Date( this.utcOffset );
+                // this should be the current date/time
+                this.proxy = new Date();
                 this.proxy.setFullYear.apply( this.proxy, a.slice(0,3) );
                 if ( a.slice(3).length ) {
                     this.proxy.setHours.apply( this.proxy, a.slice(3) );