Skip to content
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 can convert return date to persian? #38

Open
zahrat opened this issue Jan 20, 2020 · 2 comments
Open

How can convert return date to persian? #38

zahrat opened this issue Jan 20, 2020 · 2 comments

Comments

@zahrat
Copy link

zahrat commented Jan 20, 2020

I use this picker but I want to get selected date in persian not like 'Mon Jan 20 2020 19:29:15 GMT+0000'
How to change this?

@soheils2
Copy link

soheils2 commented Apr 14, 2020

I use this picker but I want to get selected date in persian not like 'Mon Jan 20 2020 19:29:15 GMT+0000'
How to change this?

ok you can install 'moment-jalaali'

its a add-on for moments.js

const JNOW = require('moment-jalaali');
import fa from "moment/src/locale/fa";
JNOW.locale("fa", fa);
JNOW.loadPersian({ usePersianDigits: true });

 function   getDate(date){
        const dte = JNOW(date).format('dddd jYY/jMM/jDD'); // or any format you wanna show
// یکشنبه 99/01/25
        const today =JNOW().format('dddd jYY/jMM/jDD');    //returns today

    }

more:
https://github.com/jalaali/moment-jalaali

@sam9010
Copy link

sam9010 commented Apr 15, 2020

this calendar return timestamp, you can convert it
and you can use to this solution:
after install this
https://www.npmjs.com/package/moment-jalaali
you can use this package:
let mydate = new Date(timestamp);
var dataJalali = moment(mydate).format('jYYYY/jMM/jDD');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants