-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add helpers to generate paper expiration date message #1468
Conversation
98a1b3c
to
f465dc8
Compare
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'aurai appelé ça makeXxx plutôt que computeXxx qu'on utilise plutôt pour calculer des valeurs ou manipuler des tableaux. Ca sous-entend un peu de calcul qu'il faut potentiellement memo, ce qui n'est pas tellement le cas ici.
@@ -435,3 +437,46 @@ export const formatContactValue = contacts => { | |||
? contacts.map(contact => `${getDisplayName(contact)}`).join(', ') | |||
: '' | |||
} | |||
|
|||
/** | |||
* @param {Object} options - Options |
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.
What could we do without you, jsdoc
const t = getLocalizer(lang) | ||
|
||
const distance = formatDistanceToNowStrict(new Date(expirationDate), { | ||
locale: lang === 'fr' ? fr : undefined |
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.
What happens when the locale is undefined?
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.
I will add a comment to explain it. It fallbacks to english by default.
f465dc8
to
2692c73
Compare
Following the work done here #1452 to mutualize logic for paper formatting, we mutualize logic for paper expiration date message like 'Expired' or 'Expires in 10 days'.
We will use these helpers in :