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

feat(#311): adds support for default date question type #328

Open
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

latin-panda
Copy link
Collaborator

@latin-panda latin-panda commented Mar 8, 2025

Closes #311

Note:

  • The e2e tests will be delivered in separate PR because the other PR that adds e2e tests hasn't been merged yet.

I have verified this PR works in these browsers (latest versions):

  • Chrome
  • Firefox
  • Safari (macOS)
  • Safari (iOS) [I don't have a device, I need help testing in iPhone]
  • Chrome for Android
  • Not applicable

What else has been done to verify that this works as intended?

Test evidence:

Browser compatibility: Chrome, Firefox, Safari (Desktop)
  • Question type becoming relevant
  • Question type as required
  • Clearing question type value
Browser.compatibility.mp4
Date Notes

Note values:

  • <date_note>2025-12-21T23:30:05</date_note>
  • <date_note>2025-12-21</date_note>
Screenshot 2025-03-10 at 9 28 57 PM
Responsive and readonly
  • Responsive
    • The calendar closes when resizing the screen
    • The calendar might not fit on the screen but allows scrolling to see more of the calendar
    • The read-only state won't allow editing the question type
responsive.and.readonly.mp4
Allows navigating across years and months. Prevent setting invalid dates.
calendar.navigation.and.prevents.wrong.dates.mp4
Compatibility with Chrome for Android
chrome.for.android.mp4
Form's error message is closable and doesn't overlap calendar
Error.message.mp4

Why is this the best possible solution? Were any other approaches considered?

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

  • Datetimes with a timezone offset will result in a null / empty string. We need user research to determine if it should honor the timezone (in local time, it could be one date back or forward) or truncate to the date part (yyyy-mm-dd) as Enketo does.

Do we need any specific form for testing your changes? If so, please attach one.

I need help testing on iPhone devices.
A test plan is in the ticket, and the test evidence is in the previous section.

What's changed

  • The @js-temporal/polyfill library was replaced with temporal-polyfill
  • Date constant file was relocated from the 'packages/xpath' to packages/common/src/constants/datetime.ts
  • A new demo form for dates was added, and also the date note was added to the note's demo form
  • New validation was added to packages/xpath/src/lib/datetime/coercion.ts to prevent out-of-range offsets
    • Webkit (Safari) parses invalid offsets like "-24:00" while Chrome and Firefox reject them. Using Temporal.TimeZone.from ensures consistent rejection of out-of-spec offsets across browsers, aligning with the Temporal spec’s max of ±23:59.
  • Adds a new Vue component for the Input Date and adds support for date notes.
  • Adds a new Date encode and encode that interprets date like or datetime like without timezone offset, to date only (yyyy-mm-dd).
  • Adds Z-index Layer System with documentation
    • Error banner doesn't overlap the calendar
    • Feedback button doesn't overlap the dialog

Note: Calendar's translation is to be resolved in this ticket: #332

Copy link

changeset-bot bot commented Mar 8, 2025

🦋 Changeset detected

Latest commit: 75e7d93

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@getodk/xforms-engine Minor
@getodk/web-forms Minor
@getodk/scenario Patch
@getodk/common Minor
@getodk/xpath Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@latin-panda latin-panda marked this pull request as ready for review March 11, 2025 04:08
@latin-panda
Copy link
Collaborator Author

latin-panda commented Mar 11, 2025

@eyelidlessness
There will be a bit of change in the CSS

  • [Done] The calendar is showing behind the floating error message from the top - I'm working on figuring out a fix (so far, z-index with a different position doesn't seem to work)
  • Maybe some adjustments in the disabled style - waiting for feedback from Aly [Edit]: Aly agrees with the current style for the disabled state. It will be improved later when updating the overall WF design after PrimeVue 4.

I'll open a separate PR for the e2e tests since we haven't merged the other PR that introduces the structure (#313)

Other than that, this is ready for a review. Please have a look when you have time 🙂

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 this pull request may close these issues.

Add default date question type
1 participant