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

data/bug #197: call date() for date type range constraints. #221

Merged
merged 1 commit into from
Mar 6, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions public/javascripts/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -509,10 +509,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