Skip to content

Commit 2d094d5

Browse files
committed
- (Refactor) Refactored the FlipClock.Time.subSeconds() method to work when the time is a date object, not an integer
1 parent 831c613 commit 2d094d5

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

src/flipclock/js/libs/time.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,11 @@
310310
* @return object Returns a digitized object
311311
*/
312312

313-
getTime: function() {
314-
var date = new Date();
313+
getTime: function(date) {
314+
if(!date) {
315+
date = this.getDateObject();
316+
}
317+
315318
var hours = date.getHours();
316319
var merid = hours > 12 ? 'PM' : 'AM';
317320
var obj = this.digitize([
@@ -374,7 +377,12 @@
374377
*/
375378

376379
addSeconds: function(x) {
377-
this.time += x;
380+
if(this.time instanceof Date) {
381+
this.time.setSeconds(this.time.getSeconds() + x);
382+
}
383+
else {
384+
this.time += x;
385+
}
378386
},
379387

380388
/**

0 commit comments

Comments
 (0)