Skip to content

Commit

Permalink
- Add iso8961 time rules (yyyy/yyyy-mm/yyyy-mm-dd) on Templates also
Browse files Browse the repository at this point in the history
  • Loading branch information
afabiani committed May 29, 2018
1 parent 990aa4b commit ed6f976
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions geonode/layers/templates/upload/layer_upload_time.html
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ <h4 class="modal-title">Modal Header</h4>
function iso8601DateFormatter(value, row, index) {
var time_checked_value = String(value);
if(data_validation && !time_checked_value.match(
/(^\d{4}$)|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+)|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d)|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d)|(\d{4}-[01]\d-[0-3]\d)|(\d{4}\/[01]\d\/[0-3]\d)/
/(^\d{4}$)|(\d{4}-[01]\d)|(\d{4}-[01]\d-[0-3]\d)|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\dZ+)|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\dZ)|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\dZ)/
)) {
time_checked_value = '<font color="red" title="' + value +'{% trans " does NOT match any valid ISO-8601 Date-Time string!" %}">' +
'<i class="fa fa-exclamation-triangle" aria-hidden="true"></i>&nbsp;' + value +'</font>';
Expand All @@ -349,7 +349,7 @@ <h4 class="modal-title">Modal Header</h4>
function iso8601Formatter(value, row, index) {
var time_checked_value = String(value);
if(data_validation && !time_checked_value.match(
/(^\d{4}$)|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\dZ+)|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\dZ)|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\dZ)/
/(^\d{4}$)|(\d{4}-[01]\d)|(\d{4}-[01]\d-[0-3]\d)|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\dZ+)|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\dZ)|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\dZ)/
)) {
time_checked_value = '<font color="red" title="' + value +'{% trans " does NOT match any valid ISO-8601 Date-Time string!" %}">' +
'<i class="fa fa-exclamation-triangle" aria-hidden="true"></i>&nbsp;' + value +'</font>';
Expand Down

0 comments on commit ed6f976

Please sign in to comment.