We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I used to convert Arabic numbers to Latin numbers by doing the following
moment.updateLocale('ar', <MomentLanguage>{ preparse: (str) => { return str.replace(/\u200f/g, ''); }, postformat: (str) => { return str; } });
but now, MomentLanguage is not a module in moment, what should I do? PS: I'm using version 2.15.2
The text was updated successfully, but these errors were encountered:
Your code is written with Typescript, right? I think the interface you're using is called Locale now.
Locale
Sorry, something went wrong.
Closing since we haven't heard back since Lucas' comment. Reopen if you still need help.
@IbraheemAlSaady this should work
const symbolMap = { '1': '1', '2': '2', '3': '3', '4': '4', '5': '5', '6': '6', '7': '7', '8': '8', '9': '9', '0': '0' }; const numberMap = { '١': '1', '٢': '2', '٣': '3', '٤': '4', '٥': '5', '٦': '6', '٧': '7', '٨': '8', '٩': '9', '٠': '0' } moment.updateLocale('ar', { preparse: function (string) { return string.replace(/\u200f/g, '').replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) { return numberMap[match]; }).replace(/،/g, ','); }, postformat: function(string) { return string.replace(/\d/g, function(match) { return symbolMap[match]; }).replace(/,/g, '،'); }, });
No branches or pull requests
I used to convert Arabic numbers to Latin numbers by doing the following
but now, MomentLanguage is not a module in moment, what should I do?
PS: I'm using version 2.15.2
The text was updated successfully, but these errors were encountered: