Feat - Handle basic date formatting using i18n #401
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe your changes
closes #391
Following the code snippet given by @yoannfleurydev, I implemented a default date formatter and displayed the possibility to create cutom ones inside the
formatters.ts
fileFor the default date formatter, I decided to use dayjs since it was already used in Start UI and because it provides a simple and easy-to-use format function.
Screenshots
Usage in the code :
![code](https://private-user-images.githubusercontent.com/135032615/255194087-7b028918-661f-4600-8f74-3aa39294af26.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjExMzMwODIsIm5iZiI6MTcyMTEzMjc4MiwicGF0aCI6Ii8xMzUwMzI2MTUvMjU1MTk0MDg3LTdiMDI4OTE4LTY2MWYtNDYwMC04Zjc0LTNhYTM5Mjk0YWYyNi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzE2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcxNlQxMjI2MjJaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0xZjA0MDg0ODY4ZTg3NmQyY2RkMzk1MWRjYjY0OGVlZjgwOTAxMWY5M2I3M2RjOTFjM2RjYTgxMTM3NzQzMWZkJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.eViNSchSUssaFRyCG5RdW7_BmRotey2w0fUnyH6Yyag)
Result :
![result](https://private-user-images.githubusercontent.com/135032615/255194113-a03cd2f5-514a-4c3d-9b45-dd6b78af93b6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjExMzMwODIsIm5iZiI6MTcyMTEzMjc4MiwicGF0aCI6Ii8xMzUwMzI2MTUvMjU1MTk0MTEzLWEwM2NkMmY1LTUxNGEtNGMzZC05YjQ1LWRkNmI3OGFmOTNiNi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzE2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcxNlQxMjI2MjJaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1mNDg1NWYyMDViODc2YTJhYzI5YTMyMjA2NTZkMTJiMTBkMWNiMjNlOGE3MWJjMGJkMTIyNjM1ODdiYTVlYjRmJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.ck9FUiXi6g3VOzuS9mLEOkoDQB-bFRar7DCqWl1Lkks)
Checklist
yarn storybook
command and everything is working