Create UI: refactor `isBetweenDates`
- Dominant language
- JavaScript
- Stars
- 23
- Forks
- 62
- Avg merge
- 24m
- Merged PRs (30d)
- 1
Description
The subject function is used as a rule to validate the date that a user has selected using the [shared Date Picker](https://github.com/bcgov/bcrs-shared-components/blob/main/src/components/date-picker/DatePicker.vue).
The problem is that this function cannot correctly convert a timezone-agnostic date (eg, "September 5, 2022") for comparison against a min and max Date object in UTC timezone.
A possible solution is to compare "dates only" (not Date objects), but this needs a bit of investigation.
What we're trying to avoid is an invalid comparison when a user has their browser set to a different timezone than Pacific (ie, where browser date may be a day before or after the Pacific date depending on the time of day).
Ref: https://github.com/bcgov/business-create-ui/pull/440#discussion_r964095951
See also: https://github.com/bcgov/business-edit-ui/blob/f69a9f5359c62570eafde93b9f8d466034fe5430/src/components/common/EffectiveDateTime.vue#L159
See also new date mixin method: https://github.com/bcgov/business-edit-ui/pull/371
See also: https://github.com/bcgov/business-edit-ui/blob/f69a9f5359c62570eafde93b9f8d466034fe5430/src/components/SpecialResolution/CreateSpecialResolution.vue#L300
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating isBetweenDates and reading the shared DatePicker.vue usage described in the issue. Compare the related date handling in EffectiveDateTime.vue, CreateSpecialResolution.vue, and the referenced date mixin method. Done means a selected timezone-agnostic date compares correctly with UTC min and max dates regardless of the browser timezone.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100