react-native-general-calendars icon indicating copy to clipboard operation
react-native-general-calendars copied to clipboard

jalaali wrong result

Open sm2017 opened this issue 6 years ago • 1 comments

@rghorbani type="gregorian" works well but , jalaali is not

<Calendar
  type="jalaali"
  onDayPress={(day, localDay) => {console.log('selected day', day.dateString, localDay.dateString)}}
  onDayLongPress={(day, localDay) => {console.log('selected day', day.dateString, localDay.dateString)}}
/>

logged console is :

selected day Û°Û¶Û²Û±-Û°Û³-Û²Û± Û°Û°Û°Û°-Û°Û±-Û°Û±

sm2017 avatar Feb 23 '19 11:02 sm2017

I had the same error But I fixed it with usePersianDigits: false

import fa from 'moment/locale/fa';
import en from 'moment/locale/en-gb'
import jmoment from "moment-jalaali";
if(lang === 'fa'){
   jmoment.locale("fa", fa);
   jmoment.loadPersian({usePersianDigits: false, dialect: 'persian-modern'})
} else {
   jmoment.loadPersian({usePersianDigits: false})
   jmoment.locale('en', en)
}

saeedkargosha avatar Jul 11 '19 08:07 saeedkargosha