0

I'm trying to show how many time went since the creation on a post! after searching I found that I have to use momentJs. The time is stored like this:

enter image description here

And I used this code to show the time

{moment.utc(post.createdAt).local().startOf('seconds').fromNow()} 

and the output is like this:

enter image description here

now the question is how change the output to arabic language?

1

2 Answers 2

1

You should add before moment

moment.locale('ar_SA'); //for Arabia 
Sign up to request clarification or add additional context in comments.

Comments

1

First I should import the Arabic library

import 'moment/locale/ar' 

then

 moment.locale('ar'); const daysAgo = moment(post.createdAt); 

And then return it

 <span> {daysAgo.fromNow()} </span> 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.