Skip to content

Commit 38b7fdd

Browse files
Improvements to microsecond prototype for Date
1 parent 1bc6cad commit 38b7fdd

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

jquery-ui-timepicker-addon.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -2111,12 +2111,16 @@
21112111
};
21122112

21132113
/*
2114-
* Rough microsecond support
2114+
* Microsecond support
21152115
*/
21162116
if(!Date.prototype.getMicroseconds){
2117-
Date.microseconds = 0;
2117+
Date.prototype.microseconds = 0;
21182118
Date.prototype.getMicroseconds = function(){ return this.microseconds; };
2119-
Date.prototype.setMicroseconds = function(m){ this.microseconds = m; return this; };
2119+
Date.prototype.setMicroseconds = function(m){
2120+
this.setMilliseconds(this.getMilliseconds() + Math.floor(m/1000);
2121+
this.microseconds = m%1000;
2122+
return this;
2123+
};
21202124
}
21212125

21222126
/*

0 commit comments

Comments
 (0)