-
Notifications
You must be signed in to change notification settings - Fork 30
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
fix(slash-react-date): correct issue with formatDateValue #741
base: main
Are you sure you want to change the base?
fix(slash-react-date): correct issue with formatDateValue #741
Conversation
mettre fix(slash): correct issue with formatDateValue en message de commit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
J'approuve car c'est un fix qui est urgent mais je me demande si avec date-fns on ne peut pas éviter d'avoir à gérer tout ça ?
Edit: je viens de voir qu'il était importé par concurrently et pas manuellement donc je n'ai rien dit 😆
1a87820
to
e7ebed9
Compare
const formattedDateValue = new globalThis.Date(dateValue); | ||
const monthFormatted = `0${formattedDateValue.getMonth() + 1}`.slice(-2); | ||
const dayFormatted = `0${formattedDateValue.getDate()}`.slice(-2); | ||
return `${formattedDateValue.getFullYear()}-${monthFormatted}-${dayFormatted}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Il y a beaucoup plus simple
const formattedDateValue = new globalThis.Date(dateValue); | |
const monthFormatted = `0${formattedDateValue.getMonth() + 1}`.slice(-2); | |
const dayFormatted = `0${formattedDateValue.getDate()}`.slice(-2); | |
return `${formattedDateValue.getFullYear()}-${monthFormatted}-${dayFormatted}`; | |
return dateValue.toISOString().slice(0, 10); |
@GuillaumeKESTEMAN aussi la raison pourquoi j'ai dû utiliser le GlobalThis c'est parce que le component Je suis plutot chaud de renommer le composant de |
Je suis d'accord, ce serait mieux mais attention cela fera un breaking change ⚠ |
Fix issue where "Date" component was not receiving the DateValue in the correct Format. Hence getMonth() was returning an exception: