angular / angular/components

feat(MatDatePicker): DateRange should implement min/max duration

Ouverte
#20,780 3 commentaires 5 réactions 0 personnes assignées Voir sur GitHub
area: material/datepicker feature P3
Langage dominant
TypeScript
Étoiles
25k
Forks
6.8k
Merge moyen
1 j 8 h
PR mergées (30 j)
91

Description

#### Feature Description

I would like to use date picker to allow a user to pick any number of days from 1-7, but no more than 7.

This could be implemented by adding a minimum (default: 1) and maximum (default: unlimited) duration values to the DateRange type.

If the minimum duration is not default:
- create greyed-out preview overlay of end values less than the minimum duration but not before the start value. Selecting a value within the minimum duration or before the start date should reset the start date to new date.

If the maximum duration is not default:
- create a preview up to the maximum duration. Selecting value beyond the maximum duration becomes new start date.

Example with (min 3 days, max 7 days) might look like something this:

(this is only to illustrate, I'm not a UI designer or anything)

#### Use Case

Currently, I must have the user use a dropdown to pick their duration first (which informs a MatDateRangeSelectionStrategy), and then use the date picker to select a start date.

Would very much like to get rid of the dropdown.

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par lire le comportement de la plage de dates de MatDatePicker et MatDateRangeSelectionStrategy décrit dans l’issue. Définissez et vérifiez le comportement des durées minimale et maximale, notamment les overlays d’aperçu et la réinitialisation de la date de début lorsqu’une sélection se trouve en dehors de la plage autorisée.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
angular, typescript
Domaine
frontend
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.