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

Commit 755cdd7

Browse files
committed
data/bug #197: call date() for date type range constraints.
1 parent 5e9bbdd commit 755cdd7

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

public/javascripts/data.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -535,10 +535,16 @@ var dataNS = odkmaker.namespace.load('odkmaker.data');
535535
// numeric/date range
536536
if ((control.range !== undefined) && (control.range !== false))
537537
{
538-
if (!$.isBlank(control.range.min))
539-
constraint.push('. >' + (control.range.minInclusive ? '= ' : ' ') + xmlValue(control.range.min));
540-
if (!$.isBlank(control.range.max))
541-
constraint.push('. <' + (control.range.maxInclusive ? '= ' : ' ') + xmlValue(control.range.max));
538+
if (!$.isBlank(control.range.min)) {
539+
var min = xmlValue(control.range.min);
540+
if (control.type === 'inputDate') min = 'date(' + min + ')';
541+
constraint.push('. >' + (control.range.minInclusive ? '= ' : ' ') + min);
542+
}
543+
if (!$.isBlank(control.range.max)) {
544+
var max = xmlValue(control.range.max);
545+
if (control.type === 'inputDate') max = 'date(' + max + ')';
546+
constraint.push('. <' + (control.range.maxInclusive ? '= ' : ' ') + max);
547+
}
542548

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

0 commit comments

Comments
 (0)