Skip to content

Commit

Permalink
Merge pull request #173 from pgelinas/fix-issue-169
Browse files Browse the repository at this point in the history
Removed usage of falsy value in if and prefer equality testing with empty string.
  • Loading branch information
jdewit committed Oct 18, 2013
2 parents e9778f7 + 8539bc8 commit cefe33e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions js/bootstrap-timepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@
},

getTime: function() {
if (!this.hour && !this.minute && !this.second) {
if (this.hour === '') {
return '';
}

Expand Down Expand Up @@ -883,7 +883,7 @@
}

// widget shouldn't be empty on open
if (!this.hour) {
if (this.hour === '') {
if (this.defaultTime) {
this.setDefaultTime(this.defaultTime);
} else {
Expand Down
2 changes: 2 additions & 0 deletions spec/js/TimepickerSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ describe('Timepicker feature', function() {
tp3.setTime('2320');
expect(tp3.getTime()).toBe('23:20:00', 'setTime with 2320 on tp3');

tp3.setTime('0:00');
expect(tp3.getTime()).toBe('0:00:00', 'setTime with 0:00 on tp3');
});

it('should update picker on blur', function() {
Expand Down

0 comments on commit cefe33e

Please sign in to comment.