nextcloud-libraries / nextcloud-libraries/nextcloud-vue
[NcDateTimePicker]: disable using not standard formatting tokens
Nobody has claimed this yet.
- Dominant language
- Vue
- Stars
- 246
- Forks
- 99
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 103
Description
Currently consumers of NcDateTimePicker can use format tokens that are specific to date-fns.
Proposed change
Forbid the usage of formatting tokens through public API that are only supported by date-fns.
Only allow tokens that are valid in the Unicode Technical Standard #35.
These patterns are not in the Unicode Technical Standard #35:
- i: ISO day of week
- I: ISO week of year
- R: ISO week-numbering year
- t: seconds timestamp
- T: milliseconds timestamp
- o: ordinal number modifier
- P: long localized date
- p: long localized time
Discard user provided format if it includes invalid tokens.
Rational
Currently NcDateTimePicker is not widely used and this change would not affect many consumers.
Before consumers start using it I would like to deprecate/disable it.
This would make migrating away from date-fns (used by default by @vuepic/vue-datepicker) possible in the future without having breaking changes that affect many consumers.
Implementation
NcDateTimePicker needs to check the provided format props for nonstandard tokens.
v8 is not affected as it does not use date-fns.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the NcDateTimePicker component and trace how its public format prop is validated before date-fns formats the value. Check the nonstandard tokens listed in the issue and verify that invalid formats are discarded while v8 remains unaffected.
Written by the indexing model from the issue text.
Assessment
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 67/100