Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor DatePicker component to improve validation behavior #3806

Merged
merged 1 commit into from
Oct 17, 2024

Conversation

4dr1en
Copy link
Contributor

@4dr1en 4dr1en commented Oct 15, 2024

Description

Playground

<script setup lang="ts">

import { notAfterDate, notBeforeDate, required } from '@/main';
import DatePicker from '@/patterns/DatePicker/DatePicker.vue';
import { ref } from 'vue';

import { reactive } from 'vue';

const piece = reactive({
	dateRedaction: '',
	dateReception: '',
});
const date = ref('')
</script>

<template>
<DatePicker
	v-model="piece.dateRedaction"
	label="Date de rédaction (optionnel)"
	bg-color="white"
	outlined
	:rules="[
		notAfterDate(piece.dateReception || ''),
	]"
/>
<br>
<DatePicker
	v-model="piece.dateReception"
	label="Date de réception"
	bg-color="white"
	outlined
	:rules="[
		required,
		notBeforeDate(piece.dateRedaction || ''),
	]"
/>


<DatePicker
	v-model="date"
	label="Date "
	outlined
	:rules="[
		required,
		notBeforeDate(piece.dateRedaction || ''),
	]"
/>
</template>

<style lang="scss" scoped></style>

Type de changement

  • Nouvelle fonctionnalité
  • Correction de bug
  • Changement cassant
  • Refactoring
  • Maintenance
  • Documentation
  • Ce changement nécessite une mise à jour de la documentation

Checklist

  • Ma Pull Request pointe vers la bonne branche
  • Mon code suit le style de code du projet
  • J'ai effectué une review de mon propre code
  • J'ai commenté mon code, en particulier dans les parties difficiles à comprendre
  • J'ai apporté les modifications correspondantes à la documentation
  • Mes modifications ne génèrent aucun nouveau warning
  • J'ai ajouté des tests qui prouvent que mon correctif est efficace ou que ma fonctionnalité fonctionne
  • Les tests unitaires passent localement avec mes modifications
  • J'ai mis à jour le fichier Changelog

@4dr1en 4dr1en added the bug Correction de bug label Oct 15, 2024
@4dr1en 4dr1en self-assigned this Oct 15, 2024
@4dr1en 4dr1en linked an issue Oct 15, 2024 that may be closed by this pull request
@DavidFyon DavidFyon merged commit 78b9849 into v2-bridge Oct 17, 2024
2 checks passed
@DavidFyon DavidFyon deleted the fix/DatePicker-rules branch October 17, 2024 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Correction de bug
Projects
Status: ✅ Terminée
Development

Successfully merging this pull request may close these issues.

DatePicker - Problème d'affichage d'erreurs
2 participants