Skip to content

Commit

Permalink
fix(reports): invalid date format
Browse files Browse the repository at this point in the history
  • Loading branch information
polonel committed Jan 15, 2019
1 parent c252b81 commit 808a740
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 49 deletions.
10 changes: 9 additions & 1 deletion src/public/js/angularjs/controllers/reports.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,17 @@
**/

define(['angular', 'underscore', 'jquery', 'moment', 'modules/helpers', 'history'], function(angular, _, $, moment, helpers) {
define(['angular', 'underscore', 'jquery', 'moment', 'modules/helpers', 'formvalidator', 'history'], function(angular, _, $, moment, helpers) {
return angular.module('trudesk.controllers.reports', [])
.controller('reportsCtrl', function($scope, $http, $log, $timeout, $window) {
$.formUtils.addValidator({
name: 'shortDate',
validatorFunction: function(value) {
return moment(value, helpers.getShortDateFormat(), true).isValid();
},
errorMessage: 'Invalid Date (' + helpers.getShortDateFormat() + ')',
errorMessageKey: 'invalidShortDate'
});

var $filterDateStart = $('.filterDate_Start');
$filterDateStart.each(function(index, element) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,14 @@
<div class="uk-grid uk-grid-collapse uk-margin-medium-bottom">
<div class="uk-width-1-2" style="padding: 0 15px 0 0;">
<label for="filterDate_Start" class="uk-form-label nopadding nomargin">Date Start</label>
<input id="filterDate_Start" class="filterDate_Start md-input label-fixed" name="filterDate_Start" type="text" data-uk-datepicker="{format:'YYYY-MM-DD'}"
data-validation="date"
data-validation-format="YYYY-MM-DD"
data-validation-error-msg="Please enter a valid Date"
<input id="filterDate_Start" class="filterDate_Start md-input label-fixed" name="filterDate_Start" type="text" data-uk-datepicker="{format:'{{data.common.shortDateFormat}}'}"
data-validation="shortDate"
/>
</div>
<div class="uk-width-1-2" style="padding: 0 0 0 15px;">
<label for="filterDate_End" class="uk-form-label nopadding nomargin">Date End</label>
<input id="filterDate_End" class="filterDate_End md-input label-fixed" name="filterDate_End" type="text" data-uk-datepicker="{format:'YYYY-MM-DD'}" value="{{formatDate now data.common.shortDateFormat}}"
data-validation="date"
data-validation-format="YYYY-MM-DD"
data-validation-error-msg="Please enter a valid Date"
<input id="filterDate_End" class="filterDate_End md-input label-fixed" name="filterDate_End" type="text" data-uk-datepicker="{format:'{{data.common.shortDateFormat}}'}" value="{{formatDate now data.common.shortDateFormat}}"
data-validation="shortDate"
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,14 @@
<div class="uk-grid uk-grid-collapse uk-margin-medium-bottom">
<div class="uk-width-1-2" style="padding: 0 15px 0 0;">
<label for="filterDate_Start" class="uk-form-label nopadding nomargin">Date Start</label>
<input id="filterDate_Start" class="filterDate_Start md-input label-fixed" name="filterDate_Start" type="text" data-uk-datepicker="{format:'YYYY-MM-DD'}"
data-validation="date"
data-validation-format="YYYY-MM-DD"
data-validation-error-msg="Please enter a valid Date"
<input id="filterDate_Start" class="filterDate_Start md-input label-fixed" name="filterDate_Start" type="text" data-uk-datepicker="{format:'{{data.common.shortDateFormat}}'}"
data-validation="shortDate"
/>
</div>
<div class="uk-width-1-2" style="padding: 0 0 0 15px;">
<label for="filterDate_End" class="uk-form-label nopadding nomargin">Date End</label>
<input id="filterDate_End" class="filterDate_End md-input label-fixed" name="filterDate_End" type="text" data-uk-datepicker="{format:'YYYY-MM-DD'}" value="{{formatDate now data.common.shortDateFormat}}"
data-validation="date"
data-validation-format="YYYY-MM-DD"
data-validation-error-msg="Please enter a valid Date"
<input id="filterDate_End" class="filterDate_End md-input label-fixed" name="filterDate_End" type="text" data-uk-datepicker="{format:'{{data.common.shortDateFormat}}'}" value="{{formatDate now data.common.shortDateFormat}}"
data-validation="shortDate"
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,14 @@
<div class="uk-grid uk-grid-collapse uk-margin-medium-bottom">
<div class="uk-width-1-2" style="padding: 0 15px 0 0;">
<label for="filterDate_Start" class="uk-form-label nopadding nomargin">Date Start</label>
<input id="filterDate_Start" class="filterDate_Start md-input label-fixed" name="filterDate_Start" type="text" data-uk-datepicker="{format:'YYYY-MM-DD'}"
data-validation="date"
data-validation-format="YYYY-MM-DD"
data-validation-error-msg="Please enter a valid Date"
<input id="filterDate_Start" class="filterDate_Start md-input label-fixed" name="filterDate_Start" type="text" data-uk-datepicker="{format:'{{data.common.shortDateFormat}}'}"
data-validation="shortDate"
/>
</div>
<div class="uk-width-1-2" style="padding: 0 0 0 15px;">
<label for="filterDate_End" class="uk-form-label nopadding nomargin">Date End</label>
<input id="filterDate_End" class="filterDate_End md-input label-fixed" name="filterDate_End" type="text" data-uk-datepicker="{format:'YYYY-MM-DD'}" value="{{formatDate now data.common.shortDateFormat}}"
data-validation="date"
data-validation-format="YYYY-MM-DD"
data-validation-error-msg="Please enter a valid Date"
<input id="filterDate_End" class="filterDate_End md-input label-fixed" name="filterDate_End" type="text" data-uk-datepicker="{format:'{{data.common.shortDateFormat}}'}" value="{{formatDate now data.common.shortDateFormat}}"
data-validation="shortDate"
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,14 @@
<div class="uk-grid uk-grid-collapse uk-margin-medium-bottom">
<div class="uk-width-1-2" style="padding: 0 15px 0 0;">
<label for="filterDate_Start" class="uk-form-label nopadding nomargin">Date Start</label>
<input id="filterDate_Start" class="filterDate_Start md-input label-fixed" name="filterDate_Start" type="text" data-uk-datepicker="{format:'YYYY-MM-DD'}"
data-validation="date"
data-validation-format="YYYY-MM-DD"
data-validation-error-msg="Please enter a valid Date"
<input id="filterDate_Start" class="filterDate_Start md-input label-fixed" name="filterDate_Start" type="text" data-uk-datepicker="{format:'{{data.common.shortDateFormat}}'}"
data-validation="shortDate"
/>
</div>
<div class="uk-width-1-2" style="padding: 0 0 0 15px;">
<label for="filterDate_End" class="uk-form-label nopadding nomargin">Date End</label>
<input id="filterDate_End" class="filterDate_End md-input label-fixed" name="filterDate_End" type="text" data-uk-datepicker="{format:'YYYY-MM-DD'}" value="{{formatDate now data.common.shortDateFormat}}"
data-validation="date"
data-validation-format="YYYY-MM-DD"
data-validation-error-msg="Please enter a valid Date"
<input id="filterDate_End" class="filterDate_End md-input label-fixed" name="filterDate_End" type="text" data-uk-datepicker="{format:'{{data.common.shortDateFormat}}'}" value="{{formatDate now data.common.shortDateFormat}}"
data-validation="shortDate"
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,14 @@
<div class="uk-grid uk-grid-collapse uk-margin-medium-bottom">
<div class="uk-width-1-2" style="padding: 0 15px 0 0;">
<label for="filterDate_Start" class="uk-form-label nopadding nomargin">Date Start</label>
<input id="filterDate_Start" class="filterDate_Start md-input label-fixed" name="filterDate_Start" type="text" data-uk-datepicker="{format:'YYYY-MM-DD'}"
data-validation="date"
data-validation-format="YYYY-MM-DD"
data-validation-error-msg="Please enter a valid Date"
<input id="filterDate_Start" class="filterDate_Start md-input label-fixed" name="filterDate_Start" type="text" data-uk-datepicker="{format:'{{data.common.shortDateFormat}}'}"
data-validation="shortDate"
/>
</div>
<div class="uk-width-1-2" style="padding: 0 0 0 15px;">
<label for="filterDate_End" class="uk-form-label nopadding nomargin">Date End</label>
<input id="filterDate_End" class="filterDate_End md-input label-fixed" name="filterDate_End" type="text" data-uk-datepicker="{format:'YYYY-MM-DD'}" value="{{formatDate now data.common.shortDateFormat}}"
data-validation="date"
data-validation-format="YYYY-MM-DD"
data-validation-error-msg="Please enter a valid Date"
<input id="filterDate_End" class="filterDate_End md-input label-fixed" name="filterDate_End" type="text" data-uk-datepicker="{format:'{{data.common.shortDateFormat}}'}" value="{{formatDate now data.common.shortDateFormat}}"
data-validation="shortDate"
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,14 @@
<div class="uk-grid uk-grid-collapse uk-margin-medium-bottom">
<div class="uk-width-1-2" style="padding: 0 15px 0 0;">
<label for="filterDate_Start" class="uk-form-label nopadding nomargin">Date Start</label>
<input id="filterDate_Start" class="filterDate_Start md-input label-fixed" name="filterDate_Start" type="text" data-uk-datepicker="{format:'YYYY-MM-DD'}"
data-validation="date"
data-validation-format="YYYY-MM-DD"
data-validation-error-msg="Please enter a valid Date"
<input id="filterDate_Start" class="filterDate_Start md-input label-fixed" name="filterDate_Start" type="text" data-uk-datepicker="{format:'{{data.common.shortDateFormat}}'}"
data-validation="shortDate"
/>
</div>
<div class="uk-width-1-2" style="padding: 0 0 0 15px;">
<label for="filterDate_End" class="uk-form-label nopadding nomargin">Date End</label>
<input id="filterDate_End" class="filterDate_End md-input label-fixed" name="filterDate_End" type="text" data-uk-datepicker="{format:'YYYY-MM-DD'}" value="{{formatDate now data.common.shortDateFormat}}"
data-validation="date"
data-validation-format="YYYY-MM-DD"
data-validation-error-msg="Please enter a valid Date"
<input id="filterDate_End" class="filterDate_End md-input label-fixed" name="filterDate_End" type="text" data-uk-datepicker="{format:'{{data.common.shortDateFormat}}'}" value="{{formatDate now data.common.shortDateFormat}}"
data-validation="shortDate"
/>
</div>
</div>
Expand Down

0 comments on commit 808a740

Please sign in to comment.