Skip to content

Commit

Permalink
data/bug getodk#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 807b58d commit 6d91547
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 @@ -526,10 +526,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 6d91547

Please sign in to comment.