Skip to content

Commit 00f9b75

Browse files
authored
Merge pull request #872 from bootboxjs/allow-date-step
Updates bootbox to allow setting the step value for date inputs
2 parents 4ab816b + 1f400ca commit 00f9b75

15 files changed

Lines changed: 87 additions & 63 deletions

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
## 6.0.3 (Latest Release)
1+
## 6.0.4 (Latest Release)
2+
3+
- Updates `step` to allow setting value for date inputs
4+
5+
### 6.0.3
26

37
-Updates `min` and `max` validation for the `number` input type to allow min and max to be equal
48

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ Bootbox **3.3.0** is the *last* release to support Bootstrap 2.2.x.
4242

4343
Much more dependency information can be found [on the Bootbox website](http://bootboxjs.com/getting-started.html#bootbox-dependencies).
4444

45-
## 6.0.3 (Latest Release)
45+
## 6.0.4 (Latest Release)
4646

47-
- Updates `min` and `max` validation for the `number` input type to allow min and max to be equal
47+
- Updates `step` to allow setting value for date inputs
4848

4949
For a full list of releases and changes please see [the changelog](https://github.com/bootboxjs/bootbox/blob/master/CHANGELOG.md).
5050

bootbox.js

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*! @preserve
22
* bootbox.js
3-
* version: 6.0.3
3+
* version: 6.0.4
44
* author: Nick Payne <nick@kurai.co.uk>
55
* license: MIT
66
* http://bootboxjs.com/
@@ -22,7 +22,7 @@
2222

2323
let exports = {};
2424

25-
let VERSION = '6.0.3';
25+
let VERSION = '6.0.4';
2626
exports.VERSION = VERSION;
2727

2828
let locales = {
@@ -93,7 +93,7 @@
9393
relatedTarget: null,
9494
// The size of the modal to generate
9595
size: null,
96-
// A unique indentifier for this modal
96+
// A unique identifier for this modal
9797
id: null
9898
};
9999

@@ -214,7 +214,7 @@
214214
exports.dialog = function (options) {
215215
if ($.fn.modal === undefined) {
216216
throw new Error(
217-
'"$.fn.modal" is not defined; please double check you have included the Bootstrap JavaScript library. See https://getbootstrap.com/docs/5.1/getting-started/introduction/ for more details.'
217+
'"$.fn.modal" is not defined; please double check you have included the Bootstrap JavaScript library. See https://getbootstrap.com/docs/5.3/getting-started/introduction/ for more details.'
218218
);
219219
}
220220

@@ -696,17 +696,12 @@
696696
input.prop({ 'required': true });
697697
}
698698

699-
// These input types have extra attributes which affect their input validation.
700-
// Warning: For most browsers, date inputs are buggy in their implementation of 'step', so this attribute will have no effect. Therefore, we don't set the attribute for date inputs.
701-
// @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date#Setting_maximum_and_minimum_dates
702-
if (options.inputType !== 'date') {
703-
if (options.step) {
704-
if (options.step === 'any' || (!isNaN(options.step) && parseFloat(options.step) > 0)) {
705-
input.attr('step', options.step);
706-
}
707-
else {
708-
throw new Error('"step" must be a valid positive number or the value "any". See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-step for more information.');
709-
}
699+
if (options.step) {
700+
if (options.step === 'any' || (!isNaN(options.step) && parseFloat(options.step) > 0)) {
701+
input.attr('step', options.step);
702+
}
703+
else {
704+
throw new Error('"step" must be a valid positive number or the value "any". See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-step for more information.');
710705
}
711706
}
712707

@@ -883,7 +878,7 @@
883878

884879
// ...and replace it with one focusing our input, if possible
885880
promptDialog.on('shown.bs.modal', function () {
886-
// Need the closure here since input isn'tcan object otherwise
881+
// Need the closure here since input isn't an object otherwise
887882
input.focus();
888883
});
889884

dist/bootbox.all.js

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*! @preserve
22
* bootbox.js
3-
* version: 6.0.3
3+
* version: 6.0.4
44
* author: Nick Payne <nick@kurai.co.uk>
55
* license: MIT
66
* http://bootboxjs.com/
@@ -22,7 +22,7 @@
2222

2323
let exports = {};
2424

25-
let VERSION = '6.0.3';
25+
let VERSION = '6.0.4';
2626
exports.VERSION = VERSION;
2727

2828
let locales = {
@@ -93,7 +93,7 @@
9393
relatedTarget: null,
9494
// The size of the modal to generate
9595
size: null,
96-
// A unique indentifier for this modal
96+
// A unique identifier for this modal
9797
id: null
9898
};
9999

@@ -213,7 +213,7 @@
213213
exports.dialog = function(options) {
214214
if ($.fn.modal === undefined) {
215215
throw new Error(
216-
'"$.fn.modal" is not defined; please double check you have included the Bootstrap JavaScript library. See https://getbootstrap.com/docs/5.1/getting-started/introduction/ for more details.'
216+
'"$.fn.modal" is not defined; please double check you have included the Bootstrap JavaScript library. See https://getbootstrap.com/docs/5.3/getting-started/introduction/ for more details.'
217217
);
218218
}
219219

@@ -702,16 +702,11 @@
702702
});
703703
}
704704

705-
// These input types have extra attributes which affect their input validation.
706-
// Warning: For most browsers, date inputs are buggy in their implementation of 'step', so this attribute will have no effect. Therefore, we don't set the attribute for date inputs.
707-
// @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date#Setting_maximum_and_minimum_dates
708-
if (options.inputType !== 'date') {
709-
if (options.step) {
710-
if (options.step === 'any' || (!isNaN(options.step) && parseFloat(options.step) > 0)) {
711-
input.attr('step', options.step);
712-
} else {
713-
throw new Error('"step" must be a valid positive number or the value "any". See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-step for more information.');
714-
}
705+
if (options.step) {
706+
if (options.step === 'any' || (!isNaN(options.step) && parseFloat(options.step) > 0)) {
707+
input.attr('step', options.step);
708+
} else {
709+
throw new Error('"step" must be a valid positive number or the value "any". See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-step for more information.');
715710
}
716711
}
717712

@@ -891,7 +886,7 @@
891886

892887
// ...and replace it with one focusing our input, if possible
893888
promptDialog.on('shown.bs.modal', function() {
894-
// Need the closure here since input isn'tcan object otherwise
889+
// Need the closure here since input isn't an object otherwise
895890
input.focus();
896891
});
897892

@@ -1209,7 +1204,7 @@
12091204

12101205
/*! @preserve
12111206
* bootbox.locales.js
1212-
* version: 6.0.3
1207+
* version: 6.0.4
12131208
* author: Nick Payne <nick@kurai.co.uk>
12141209
* license: MIT
12151210
* http://bootboxjs.com/

dist/bootbox.all.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/bootbox.js

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*! @preserve
22
* bootbox.js
3-
* version: 6.0.3
3+
* version: 6.0.4
44
* author: Nick Payne <nick@kurai.co.uk>
55
* license: MIT
66
* http://bootboxjs.com/
@@ -22,7 +22,7 @@
2222

2323
let exports = {};
2424

25-
let VERSION = '6.0.3';
25+
let VERSION = '6.0.4';
2626
exports.VERSION = VERSION;
2727

2828
let locales = {
@@ -93,7 +93,7 @@
9393
relatedTarget: null,
9494
// The size of the modal to generate
9595
size: null,
96-
// A unique indentifier for this modal
96+
// A unique identifier for this modal
9797
id: null
9898
};
9999

@@ -214,7 +214,7 @@
214214
exports.dialog = function (options) {
215215
if ($.fn.modal === undefined) {
216216
throw new Error(
217-
'"$.fn.modal" is not defined; please double check you have included the Bootstrap JavaScript library. See https://getbootstrap.com/docs/5.1/getting-started/introduction/ for more details.'
217+
'"$.fn.modal" is not defined; please double check you have included the Bootstrap JavaScript library. See https://getbootstrap.com/docs/5.3/getting-started/introduction/ for more details.'
218218
);
219219
}
220220

@@ -696,17 +696,12 @@
696696
input.prop({ 'required': true });
697697
}
698698

699-
// These input types have extra attributes which affect their input validation.
700-
// Warning: For most browsers, date inputs are buggy in their implementation of 'step', so this attribute will have no effect. Therefore, we don't set the attribute for date inputs.
701-
// @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date#Setting_maximum_and_minimum_dates
702-
if (options.inputType !== 'date') {
703-
if (options.step) {
704-
if (options.step === 'any' || (!isNaN(options.step) && parseFloat(options.step) > 0)) {
705-
input.attr('step', options.step);
706-
}
707-
else {
708-
throw new Error('"step" must be a valid positive number or the value "any". See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-step for more information.');
709-
}
699+
if (options.step) {
700+
if (options.step === 'any' || (!isNaN(options.step) && parseFloat(options.step) > 0)) {
701+
input.attr('step', options.step);
702+
}
703+
else {
704+
throw new Error('"step" must be a valid positive number or the value "any". See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-step for more information.');
710705
}
711706
}
712707

@@ -883,7 +878,7 @@
883878

884879
// ...and replace it with one focusing our input, if possible
885880
promptDialog.on('shown.bs.modal', function () {
886-
// Need the closure here since input isn'tcan object otherwise
881+
// Need the closure here since input isn't an object otherwise
887882
input.focus();
888883
});
889884

dist/bootbox.locales.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*! @preserve
22
* bootbox.locales.js
3-
* version: 6.0.3
3+
* version: 6.0.4
44
* author: Nick Payne <nick@kurai.co.uk>
55
* license: MIT
66
* http://bootboxjs.com/

dist/bootbox.locales.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)