Permalink
Browse files

Merge pull request #173 from pgelinas/fix-issue-169

Removed usage of falsy value in if and prefer equality testing with empty string.
  • Loading branch information...
2 parents e9778f7 + 8539bc8 commit cefe33ee70ae2c6a995ab232016f9059d9dc606c @jdewit committed Oct 18, 2013
Showing with 4 additions and 2 deletions.
  1. +2 −2 js/bootstrap-timepicker.js
  2. +2 −0 spec/js/TimepickerSpec.js
View
4 js/bootstrap-timepicker.js
@@ -319,7 +319,7 @@
},
getTime: function() {
- if (!this.hour && !this.minute && !this.second) {
+ if (this.hour === '') {
return '';
}
@@ -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 {
View
2 spec/js/TimepickerSpec.js
@@ -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() {

0 comments on commit cefe33e

Please sign in to comment.