-
Notifications
You must be signed in to change notification settings - Fork 158
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
How to customize local strings #167
Comments
@Anisi This library is based on the standard moment.js API, in other words this guide should work for you: https://momentjs.com/docs/#/customization/relative-time/ let me know if you fail to get it working. |
Thank you for your quick response |
It should. are you calling |
Yeah! it should, but it doesn't. moment.loadPersian({usePersianDigits: true});
moment.updateLocale('fa', {
relativeTime: {
future: "تا %s",
past: "%s ago",
s: 'چند ثانیه',
ss: '%d ثانیه',
m: "یک دقیقه",
mm: "%d دقیقه",
h: "یک ساعت",
hh: "%d ساعت",
d: "یک روز",
dd: "%d روز",
M: "یک ماه",
MM: "%d ماه",
y: "یک سال",
yy: "%d سال"
}
});
let momentFa = moment;
export {momentFa}; render() {
const openingTime = this.state.summarise ? this.state.summarise.order_time_period.order_opening_time : null;
const closingTime = this.state.summarise ? this.state.summarise.order_time_period.order_closing_time : null;
const serverTime = this.state.summarise ? this.state.summarise.server_time : null;
const inOrderTime = openingTime && closingTime ? momentFa(serverTime).isBetween(momentFa(openingTime), momentFa(closingTime)) : false;
const timeToOpening = serverTime ? momentFa(serverTime).to(openingTime) : '';
return (
!inOrderTime &&
<aside id="opening-bar">
<h3><i className="icon icon-clock"></i> {timeToOpening} دیگه میتونین سفارش بدین</h3>
</aside>
)
} Example output: در 1 دقیقه دیگه میتونین سفارش بدین But should be: تا یک دقیقه دیگه میتونین سفارش بدین |
I also need and example of how you're testing this. like expected output... actual output... |
Added new details |
Hi
Could you please tell me what have I to do if I want to customize local strings like
relativeTime
?The text was updated successfully, but these errors were encountered: