-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Missing several format options #60
Comments
In my humble opinion, the only useful ones in that list are |
I would tend to agree, I think that Q, DDD/DDDD, X/x, and S/SS/SSS are definitely not necessary. I think if h/hh is included, then a/A should probably be included as well, or you lose the ability to show specific times (1:00 vs 1:00 AM). "Do" is kind of up in the air for me, because I've had clients who've insisted on having the ordinal (1st, 2nd, 3rd, etc) shown, but it's something that a user could implement on their own. I think most of it comes down to "what should be provided by a library" vs. "what can a user be reasonably expected to write themselves," and I think that's mostly up to the owner of the repo. |
I tend to agree adding h/hh & a/A(with local). And leave the rest formats to a separate plugin, maybe called import { AdvFormat } from 'dayjs/plugin'
dayjs.extend('AdvFormat') // a plugin might add a new API or overwrite the existing one
//here it just overwrite the core.format
dayjs.format('Do SSS ... something less useful format') |
I've updated #68 to only have AM/PM and 12 hour time support, with additional options included in another plugin (and the addition of a plugin system). |
The Moment docs have a number of format options which are missing from DayJS. Some of them, like the locality specific ones, I think it makes sense to exclude, but there are others that are missing that could be included without having a serious impact on the library size.
Here are the missing formats that I propose are added:
However, this would nearly double the size of the format function, which isn't ideal. Are there any of those that shouldn't be added?
The text was updated successfully, but these errors were encountered: