Closed SaeedZhiany closed 6 years ago
Please refer to Moment and MomentJalaali docs.
jMoment.loadPersian({dialect: 'persian-modern'})
I try that and what document mentioned, but nothing happens! please provide a detailed example if it's possible. or edit code below. what I'm doing wrong?
import {Calendar, CalendarList, Agenda} from 'react-native-general-calendars';
import Moment from 'moment-jalali';
type Props = {};
export default class App extends Component<Props> {
constructor() {
super();
Moment.loadPersian({dialect: 'persian-modern'});
}
render() {
//Moment.loadPersian({dialect: 'persian-modern'});
return (
<View style={styles.container}>
<Calendar
type="jalaali"
onDayPress={(day, localDay) => {
console.log('selected day', day, localDay)
}}
// Handler which gets executed when press arrow icon left. It receive a callback can go back month
onPressArrowLeft={substractMonth => substractMonth()}
// Handler which gets executed when press arrow icon left. It receive a callback can go next month
onPressArrowRight={addMonth => addMonth()}
/>
</View>
);
}
}
if the pull request #13 has been merged, user can switch between localizations in his/her code, here an example:
const jMoment = require('moment-jalaali');
.
.
.
jMoment.locale('en'); // for english localization
or
jMoment.loadPersian({dialect: 'persian-modern'}); // for persian localization
I can not change calendar localization, please provide more detail on this subject, in your wiki.
where exactly I must put this code?
import Moment from 'moment';