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

Add JavaScript dateFormat & numberFormat function #299

Closed
JSteunou opened this issue Aug 29, 2018 · 5 comments
Closed

Add JavaScript dateFormat & numberFormat function #299

JSteunou opened this issue Aug 29, 2018 · 5 comments

Comments

@JSteunou
Copy link
Contributor

Is your feature request related to a problem? Please describe.

For a usage outside of react, in javascript i18n contains t, plural, select, selectOrdinal but no dateFormat nor numberFormat helpers like react components.

Using date from core works, but it requires to create a function with current language before being able to use it. If you don't have the need for cached formatter this is tedious.

This is just sugar, but nice sugar :)

Describe the solution you'd like

i18n.dateFormat('2018-08-29', {weekday: 'long', year: 'numeric', month: 'long', day: 'numeric'})

Describe alternatives you've considered

import {date} from '@lingui/core'

date(i18n.language, {weekday: 'long', year: 'numeric', month: 'long', day: 'numeric'})('2018-08-29')
@tricoder42
Copy link
Contributor

Sounds good! I don't know why it's not included already.

Interested in sending PR?

@JSteunou
Copy link
Contributor Author

I would but I have very limited bandwidth so do not wait for me :(

@JSteunou
Copy link
Contributor Author

JSteunou commented Sep 7, 2018

👍 🍺

@tricoder42
Copy link
Contributor

Released in v2.7.0.

@JSteunou
Copy link
Contributor Author

Thank you a ton @tricoder42 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants