Comments (4)
I think we could create a function called formatWithLocale()
which works exactly like format
but receives a locale object as first argument. Then, the format
function could just be a curried version of formatWithLocale
:
const format = formatWithLocale(DEFAULT_LOCALE)
With this approach, I could create formatters with any locale:
import { formatWithLocale } from 'date-fp'
// I can define my own locale
const LOCALE_PT_BR = {
MONTHS: ...,
WEEKDAYS: ...,
...
}
export const formatPtBr = formatWithLocale(LOCALE_PT_BR)
It would be nice to have some locales available in the package too:
import { formatWithLocale } from 'date-fp'
import LOCALE_PT_BR from 'date-fp/locales/pt-br'
export const formatPtBr = formatWithLocale(LOCALE_PT_BR)
@cullophid, what you think?
from date-fp.
That sounds like a great idea!
I would merge that PR ;)
from date-fp.
@cullophid What about i18n support?
from date-fp.
IMO the library should stay as it is, or expand but leaving i18n outside of the movie as that can be handled by Intl.DateTimeFormat.
from date-fp.
Related Issues (19)
- Build issues HOT 4
- Timezone Support HOT 1
- Invalid Input To D.format HOT 1
- Support week numbers in formatting and parsing HOT 8
- timezone-related functions HOT 13
- Support for get('day') HOT 3
- format is not pure HOT 34
- get timezoneOffset test fails HOT 1
- Publish modularized files HOT 2
- Set function always returns 'Invalid date' for 'days', 'months' and 'years' HOT 3
- https://evilcorp.limited/date-fp - Your connection is not secure HOT 3
- Return 0 when get('week') HOT 6
- the purity behind the curtain ... HOT 1
- Add or subtract 'weeks' as a timespan? HOT 2
- Question: compose get('day') and sub('days') HOT 3
- Support for ISO 8601 compliant zoned date times HOT 3
- Add TypeScript typings HOT 1
- Strange warning HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from date-fp.