Skip to content

Commit cefe33e

Browse files
committed
Merge pull request #173 from pgelinas/fix-issue-169
Removed usage of falsy value in if and prefer equality testing with empty string.
2 parents e9778f7 + 8539bc8 commit cefe33e

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

js/bootstrap-timepicker.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@
319319
},
320320

321321
getTime: function() {
322-
if (!this.hour && !this.minute && !this.second) {
322+
if (this.hour === '') {
323323
return '';
324324
}
325325

@@ -883,7 +883,7 @@
883883
}
884884

885885
// widget shouldn't be empty on open
886-
if (!this.hour) {
886+
if (this.hour === '') {
887887
if (this.defaultTime) {
888888
this.setDefaultTime(this.defaultTime);
889889
} else {

spec/js/TimepickerSpec.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ describe('Timepicker feature', function() {
217217
tp3.setTime('2320');
218218
expect(tp3.getTime()).toBe('23:20:00', 'setTime with 2320 on tp3');
219219

220+
tp3.setTime('0:00');
221+
expect(tp3.getTime()).toBe('0:00:00', 'setTime with 0:00 on tp3');
220222
});
221223

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

0 commit comments

Comments
 (0)