-
-
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
Non-Arabic Numerals #416
Comments
You may could extend
|
@bcmn You might could simply do a global replace('1234', '۰۱۲۳۴۵۶۷۸۹') on the final This might be easy and without a dayjs plugin. |
@VehpuS great job, THX. I think we could mark this issue as fixed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Our specific use case requires for conditionally displaying "eastern arabic numerals"
۰۱۲۳۴۵۶۷۸۹
instead of "arabic numerals"0123456789
. Presumably any implementation would be intended to be easily extensible for any other commonly-used base 10 numeral systems.This would result in DayJS strings like:
instead of (the current behaviour):
This issue is primarily to ascertain whether this is something that other people would feel is useful or necessary to have as a plugin for DayJS, though there are also some implementation issues that might be useful to discuss.
Obviously the alternative is that this could remain a bespoke implementation detail, & our project just treats this as a generic string formatting operation, completely unaware of DayJS.
Implementation Thoughts
After a quick investigation, I'm not sure DayJS currently has a way of applying this sort of library-wide formatting operation to all strings returned?
It is very easy to add the behaviour to any one function, e.g.
.format
or the overridden.format
function of theadvancedFormat
plugin, but this would very noticeably miss applying the logic to other plugins, such asrelativeTime
. Is there a better solution than this?I'm aware
advancedFormat
currently uses binding to achieve some conditional formatting. There may be a way to do this for all plugins that might return a string containing a numeral, but it doesn't seem ideal. 🤔The text was updated successfully, but these errors were encountered: