Open zahrat opened 4 years ago
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
}
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');
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?