nextcloud-libraries / nextcloud-libraries/nextcloud-vue

[NcDateTimePicker]: disable using not standard formatting tokens

Open
#8,931 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

deprecation feature: datepicker
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

https://date-fns.org/v4.4.0/docs/format

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.