Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation of dateTime widget against now() fails #637

Open
yanokwa opened this issue Jun 30, 2021 · 2 comments · May be fixed by #652
Open

Validation of dateTime widget against now() fails #637

yanokwa opened this issue Jun 30, 2021 · 2 comments · May be fixed by #652

Comments

@yanokwa
Copy link
Member

yanokwa commented Jun 30, 2021

Software and hardware versions

Collect v2012.2

Problem description

A constraint of . <= now() on a dateTime widget doesn't constrain when I enter today's date plus an hour later than now. Putting a day later than now works. It would seems only the date is being checked.

In my debugging, when I output the dateTime value in a note, it only shows the date. Using the jump button shows me both date and time. The XML that is persisted shows <rdt_start_time>2021-06-15T01:33:00.000-07:00</rdt_start_time>.

datetime.xlsx is the form I used.

Other information

Enketo shows the datetime, but also seems to check the constraint against only the date.

@lognaturel lognaturel transferred this issue from getodk/collect Jun 30, 2021
@lognaturel
Copy link
Member

For now I'd consider comparing the date and time separately using date/time functions. You'd need to experiment to figure out the best way to do this -- there's a lot of weirdness in the date/time world.

@lognaturel
Copy link
Member

decimal-date-time(.) <= decimal-date-time(now()) does work. I think this is related to the broader theme of "type coercion for date/time/datetime is buggy and/or unexpected". At some point we probably need to review the spec and see what kind of coercion is supposed to happen in an expression like . <= now().

@dimwight dimwight linked a pull request Nov 21, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants