[PER-10641] Create edtf date dropdown component#1047
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1047 +/- ##
==========================================
+ Coverage 50.39% 50.96% +0.56%
==========================================
Files 351 352 +1
Lines 11714 11905 +191
Branches 2058 2122 +64
==========================================
+ Hits 5903 6067 +164
- Misses 5608 5613 +5
- Partials 203 225 +22 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
d223eda to
1312842
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces new EDTF-focused date/time UI building blocks (date picker, time picker, timezone dropdown) and wires an EDTF date picker into the file-browser sidebar behind a feature flag, supported by a substantial expansion/refactor of the shared EdtfService.
Changes:
- Added reusable date/time input components and a sidebar EDTF date picker UI (feature-flagged).
- Refactored
EdtfServiceparsing/serialization and expanded validation helpers + test coverage. - Added
displayTimemapping support to the record repo + improved edit-service error handling/revert behavior.
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| src/styles/_mixins.scss | Adds new SCSS mixins used by the new date/time components. |
| src/styles/_colors.scss | Adds PR blue shade tokens used by the new component styles. |
| src/app/shared/services/edtf-service/edtf.service.ts | Major refactor/expansion of EDTF parsing, formatting, validation, and timezone-display helpers. |
| src/app/shared/services/edtf-service/edtf.service.spec.ts | Updates and expands unit tests for the new EDTF behavior and helper methods. |
| src/app/shared/services/api/record.repo.ts | Adds optional displayTime support in Stela record mapping. |
| src/app/shared/services/api/record.repo.spec.ts | Adds tests verifying displayTime mapping behavior. |
| src/app/shared/components/timezone-dropdown/timezone-dropdown.component.ts | Adds standalone timezone dropdown component sourcing IANA zones via Intl. |
| src/app/shared/components/timezone-dropdown/timezone-dropdown.component.spec.ts | Adds unit tests for timezone dropdown behavior. |
| src/app/shared/components/timezone-dropdown/timezone-dropdown.component.scss | Styles for the timezone dropdown. |
| src/app/shared/components/timezone-dropdown/timezone-dropdown.component.html | Template for timezone dropdown UI. |
| src/app/shared/components/timepicker-input/timepicker-input.component.ts | Adds standalone time input + ng-bootstrap timepicker dropdown behavior. |
| src/app/shared/components/timepicker-input/timepicker-input.component.spec.ts | Adds unit tests for timepicker input interactions/validation. |
| src/app/shared/components/timepicker-input/timepicker-input.component.scss | Styles for the timepicker input. |
| src/app/shared/components/timepicker-input/timepicker-input.component.html | Template for timepicker input UI. |
| src/app/shared/components/datepicker-input/datepicker-input.component.ts | Adds standalone date input + ng-bootstrap datepicker dropdown behavior. |
| src/app/shared/components/datepicker-input/datepicker-input.component.spec.ts | Adds unit tests for datepicker input interactions/validation. |
| src/app/shared/components/datepicker-input/datepicker-input.component.scss | Styles for the datepicker input. |
| src/app/shared/components/datepicker-input/datepicker-input.component.html | Template for datepicker input UI. |
| src/app/file-browser/file-browser-components.module.ts | Imports the new sidebar date picker component into the file-browser module. |
| src/app/file-browser/components/sidebar/sidebar.component.ts | Integrates EDTF date picker into the sidebar behind edtf-date feature flag; adds save handler. |
| src/app/file-browser/components/sidebar/sidebar.component.spec.ts | Updates sidebar tests for feature flag handling and new dependencies. |
| src/app/file-browser/components/sidebar/sidebar.component.scss | Switches to Sass @use for variables import. |
| src/app/file-browser/components/sidebar/sidebar.component.html | Feature-flagged switch between legacy inline date edit and new EDTF picker UI. |
| src/app/file-browser/components/sidebar-date-picker/sidebar-date-picker.component.ts | Adds the sidebar EDTF date picker component and related formatting logic. |
| src/app/file-browser/components/sidebar-date-picker/sidebar-date-picker.component.spec.ts | Adds unit tests for sidebar date picker rendering and interactions. |
| src/app/file-browser/components/sidebar-date-picker/sidebar-date-picker.component.scss | Styles for the sidebar date picker dropdown/panel. |
| src/app/file-browser/components/sidebar-date-picker/sidebar-date-picker.component.html | Template for the sidebar date picker UI. |
| src/app/core/services/edit/edit.service.ts | Improves error handling: reverts property on failure and shows error messages. |
| src/app/core/services/edit/edit.service.spec.ts | Adds tests ensuring revert + error messaging behavior on save failures. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
05e98b2 to
e00e0ae
Compare
That makes more sense, yes. I have been working on this today, but I got some conflicts that didn't manage to fix yet.(Some commits SHAs have diverted, not sure why) I should have this rebased on the correct branch tomorrow, as I am almost done with rebasing them correctly locally. |
004db68 to
9b1c23d
Compare
@cecilia-donnelly Success! I have managed to create the right history, so now it only shows the changes specific to this branch. |
|
Thanks much @aasandei-vsp ! @slifty and I are splitting these up so he also has an idea of what's going on, so that's why I removed myself. :) |
e00e0ae to
c224290
Compare
9b1c23d to
c99bc7c
Compare
|
@slifty Just wanted to mention that the last commit is a bug fix. The review fixes are in the commit: "Improve EDTF sidebar date handling" |
slifty
left a comment
There was a problem hiding this comment.
Looks like my feedback is addressed ty!
Created a new component that shows a dropdown for picking up a date in the sidebar. This uses the date and time pickers and integrates with the BE. Issue: PER-10641
The integration of the sidebar-date-picker component in the sidebar is hidden under a flag. Issue: PER-10641
In the edtf date dropdown and modal, when year, month or day have undefined digits, replace them with X values for display and leave them as empty in the inputs. PER-10641
Normalize the Intl-produced timezone name so offset-only zones display as e.g. GMT+03:00. Issue: PER-10641
- Cache displayTimeObject instead of recomputing it in a template getter. - Show a translatable generic error on save failure; log the raw error. - Remove the unused isNumeric helper. Issue: PER-10641
- Zero-pad single-digit days left ("9" -> "09") instead of X-padding,
which produced invalid days that failed to save.
- Accept a lone digit so backspace works on a padded day like "05".
- Re-sync the picker to the stored value when a save fails.
Issue: PER-10641
60d74a5 to
c451946
Compare
QA InstructionsSummaryThis PR introduces a new sidebar date dropdown component for handling EDTF (Extended Date/Time Format) date inputs. The feature is guarded by the Test Environment Setup
Test ScenariosA. FLAG ON - EDTF Date Dropdown1. Date and Time Input Handling
2. Date with Unspecified Digits
3. Cancel Functionality
4. Persistence
B. FLAG OFF - Standard Datepicker1. Modify and Save Date
2. Handling START and END Dates
Regression Risks
Things to Watch For
These instructions should cover validation of the new feature as well as any associated risks from the changes introduced. Generated by QA Instructions Action |
omnignorant
left a comment
There was a problem hiding this comment.
This appears to be working as expected! However, two notes:
- I don't see any way to modify timezone. Presumably this is out of scope for this PR.
- I am not able to toggle the feature flag status on dev, so I could only test it ON
|
!!! This functionality is hidden under a flag:
edtf-date. We need to make sure the flag is on only for testing, but not in production.Manual test cases — sidebar date dropdown
Setup (run once before the tests):
EXPECTED: The sidebar appears with a Date section.
STEPS TO TEST:
FLAG ON:
Date and time:
Open the dropdown.
Enter April 12, 1985 in the date input.
In the time input, enter 02:30:00 and toggle the meridian to PM.
Click Save.
EXPECTED: The sidebar shows "April 12, 1985 • 02:30:00 PM" with the browser timezone abbreviation appended (e.g. "EST").
Open the dropdown.
Click the date picker button and select 22 May 2025.
Click the time picker button and enter 10:22:33 and toggle the meridian to AM.
Click Save.
EXPECTED: The sidebar shows "May 22, 2025 • 10:22:33 AM" with the browser timezone abbreviation appended (e.g. "EST").
Date with unspecified digits:
1988in the year input, leave the month empty, and15in the day.EXPECTED: The sidebar shows "1988-XX-15".
Cancel:
EXPECTED: The dropdown reopens with the saved date and time pre-filled.
EXPECTED: The dropdown closes and the sidebar still shows "April 12, 1985". No changes are persisted.
Check the updated date persisted:
EXPECTED: The sidebar updates to "April 20, 1985".
EXPECTED: The sidebar still shows "April 20, 1985".
FLAG OFF:
Select a record.
Click the date.
EXPECTED: The datepicker dropdown appears.
Modify the date and time.
Click the SAVE button.
EXPECTED: The newly selected date and time are shown in the sidebar.
Refresh the browser.
EXPECTED: The date that has bin filled is still present.
Select a folder.
Click the START date.
EXPECTED: The datepicker dropdown appears.
Modify the date and time.
Click the SAVE button.
Click the END date.
EXPECTED: The datepicker dropdown appears.
Modify the date and time.
Click the SAVE button.
EXPECTED: The newly selected date and time for START and END date are shown in the sidebar.
Refresh the browser.
EXPECTED: The date that has been filled is still present.