Skip to content

Commit

Permalink
Merge pull request #131 from legalthings/Fix_for_min_max_date_options
Browse files Browse the repository at this point in the history
Fix for min/max date options
  • Loading branch information
svenstm committed Mar 18, 2019
2 parents da82e1f + 77848a4 commit 8eaeb6c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
4 changes: 2 additions & 2 deletions js/legalform-validation.js
Expand Up @@ -271,8 +271,8 @@
if (meta.type === 'date') {
var yearly = !!$input.attr('yearly');
var date = moment(value, yearly ? 'DD-MM' : 'DD-MM-YYYY', true);
var minDate = moment(meta.min_date, 'DD-MM-YYYY', true);
var maxDate = moment(meta.max_date, 'DD-MM-YYYY', true);
var minDate = moment($input.attr('min_date'), 'DD-MM-YYYY', true);
var maxDate = moment($input.attr('max_date'), 'DD-MM-YYYY', true);
var valid = date.isValid();

if (valid && minDate.isValid()) {
Expand Down
14 changes: 13 additions & 1 deletion js/ractive-legalform.js
Expand Up @@ -431,7 +431,19 @@
$inputGroup.datetimepicker({
locale: ractive.getLocale('short'),
format: yearly ? 'DD-MM' : 'DD-MM-YYYY',
dayViewHeaderFormat: yearly ? 'MMMM' : 'MMMM YYYY'
dayViewHeaderFormat: yearly ? 'MMMM' : 'MMMM YYYY',

//Allow arrow keys navigation inside date text field
keyBinds: {
up: null,
down: function (widget) {
if (!widget) this.show();
},
left: null,
right: null,
t : null,
delete : null
}
});

$(e.target).closest('.input-group-addon').trigger('click');
Expand Down

0 comments on commit 8eaeb6c

Please sign in to comment.