Jalaali calendar does not work correctly when "current" props set by jalaali date
SaeedZhiany opened this issue · comments
Here is my code,
when I set correspond gregorian date or not set the current props, calendar is working properly and it set to current date of system in jalaali mode. but it doesn't when I manually set the date in props.
export default class App extends Component<Props> {
render() {
return (
<View style={styles.container}>
<Calendar
type="jalaali"
current="1397-05-28"
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()}
style={{
borderWidth: 1,
borderColor: 'black',
height: 350
}}
// Specify theme properties to override specific styles for calendar parts. Default = {}
theme={{
backgroundColor: '#ffffff',
calendarBackground: '#ffffff',
textSectionTitleColor: '#b6c1cd',
selectedDayBackgroundColor: '#00adf5',
selectedDayTextColor: '#ffffff',
todayTextColor: '#00adf5',
dayTextColor: '#2d4150',
textDisabledColor: '#d9e1e8',
dotColor: '#00adf5',
selectedDotColor: '#ffffff',
arrowColor: 'orange',
monthTextColor: 'blue',
textDayFontFamily: 'monospace',
textMonthFontFamily: 'monospace',
textDayHeaderFontFamily: 'monospace',
textMonthFontWeight: 'bold',
textDayFontSize: 16,
textMonthFontSize: 16,
textDayHeaderFontSize: 16
}}
/>
</View>
);
}
}
for more details, I bring here result of onDayPress
function.
result of press on day 1
'selected day', { year: 1397,
month: 5,
day: 21,
timestamp: -18069955200000,
dateString: '1397-05-21' }, { year: 776,
month: 3,
day: 1,
timestamp: -18069955200000,
dateString: '0776-03-01' }
result of press on day 15
'selected day', { year: 1397,
month: 6,
day: 4,
timestamp: -18068745600000,
dateString: '1397-06-04' }, { year: 776,
month: 3,
day: 15,
timestamp: -18068745600000,
dateString: '0776-03-15' }
Is it a bug or I am doing something wrong in my code?
@SaeedZhiany You should use gregorian for the functionality.
For example:
type="jalaali"
current="2018-06-06"