Conversation
6af8b45 to
db62dbc
Compare
| endOfYear, | ||
| Locale | ||
| } from "date-fns"; | ||
| import * as Locales from 'date-fns/locale'; |
There was a problem hiding this comment.
I came up with the same solution first but then I wondered if this will affect the bundle size.
If the date-fns library would be a peer dependency #5 (comment): What about accepting the locale object as an optional parameter instead of a locale string? Then it will be up to the developer how the locale will be loaded (using a fixed set of locales or loaded dynamically).
I guess this would be a breaking change.
There was a problem hiding this comment.
You're right, I initially considered accepting the locale as an object, but since we already have the option to pass the locale as a string, I wasn't sure how to approach this. Do you think it would be beneficial to accept the locale object in the options instead? However, this would mean exposing an internal dependency, the date-fns locales.
|
Hi all! I understand there is an unresolved discussion about whether little-date should continue using strings to define the locale format ( In any case, while this debate remains unresolved, the string option currently works only for time format and not for date format, correct? Do you plan to decide how to address this issue soon? I would love to change the date format to match my locale. |
|
This PR made me try to create a similar date formatting library by using available Web APIs like Intl DateTimeFormat formatRange instead of date-fns. The only dependency is Tempo by FormKit (which has no dependencies) that provides some utility functions for date comparison and timezone calculations. I have not been working on it since I made a first release a few months ago, but I hope it could work as an alternative to this library. |
Hello guys, I made the changes to allow passing the locale in the format calls, and I think this might resolve #6 .
I hope this helps! I'm available for any further adjustments if needed.