Skip to content
This repository has been archived by the owner on Nov 2, 2023. It is now read-only.

Commit

Permalink
data/bug #197: call date() for date type range constraints.
Browse files Browse the repository at this point in the history
  • Loading branch information
issa-tseng committed Mar 6, 2019
1 parent 5e9bbdd commit 755cdd7
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions public/javascripts/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -535,10 +535,16 @@ var dataNS = odkmaker.namespace.load('odkmaker.data');
// numeric/date range
if ((control.range !== undefined) && (control.range !== false))
{
if (!$.isBlank(control.range.min))
constraint.push('. >' + (control.range.minInclusive ? '= ' : ' ') + xmlValue(control.range.min));
if (!$.isBlank(control.range.max))
constraint.push('. <' + (control.range.maxInclusive ? '= ' : ' ') + xmlValue(control.range.max));
if (!$.isBlank(control.range.min)) {
var min = xmlValue(control.range.min);
if (control.type === 'inputDate') min = 'date(' + min + ')';
constraint.push('. >' + (control.range.minInclusive ? '= ' : ' ') + min);
}
if (!$.isBlank(control.range.max)) {
var max = xmlValue(control.range.max);
if (control.type === 'inputDate') max = 'date(' + max + ')';
constraint.push('. <' + (control.range.maxInclusive ? '= ' : ' ') + max);
}

invalidText = 'Value must be between ' + $.emptyString(control.range.min, 'anything') + ' and ' + $.emptyString(control.range.max, 'anything');
}
Expand Down

0 comments on commit 755cdd7

Please sign in to comment.