Skip to content

Commit

Permalink
Merge pull request #234 from AtlasOfLivingAustralia/feature/issue231
Browse files Browse the repository at this point in the history
Minor usability improvements with dates. #231
  • Loading branch information
salomon-j authored Feb 20, 2024
2 parents 36ea780 + f52c135 commit 6406906
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions grails-app/assets/javascripts/forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,14 @@ function orEmptyArray(v) {
return _.isEqual(value1, value2);
};

parser.functions.formatDateForValidation = function(value) {
if (!value) {
return '';
}

return moment(value).format('DD-MM-YYYY');
}

var specialBindings = function() {

return {
Expand Down
2 changes: 1 addition & 1 deletion grails-app/views/output/_dateDataTypeEditModelTemplate.gsp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div id="${context.source}Date" class="input-group">
<input class="form-control form-control-sm inputDatePicker" ${context.attributes} data-bind="${context.databindAttrs}" type="text" size="12" ${context.validationAttr}/>
<input class="form-control form-control-sm inputDatePicker" ${context.attributes} data-bind="${context.databindAttrs}" type="text" size="12" autocomplete="off" ${context.validationAttr}/>
<div class="input-group-append">
<span class="add-on input-group-text open-datepicker"><i class="fa fa-th"></i></span>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public class EditModelWidgetRenderer implements ModelWidgetRenderer {
@Override
void renderSimpleDate(WidgetRenderContext context) {
context.databindAttrs.add 'datepicker', context.source + '.date'
context.writer << "<input${context.attributes.toString()} data-bind='${context.databindAttrs.toString()}'${context.validationAttr} type='text' class='form-control form-control-sm input-small'/>"
context.writer << "<input${context.attributes.toString()} data-bind='${context.databindAttrs.toString()}'${context.validationAttr} type='text' autocomplete='off' class='form-control form-control-sm input-small'/>"
}

@Override
Expand Down

0 comments on commit 6406906

Please sign in to comment.