react-native-calendars moved 1 day forward

Created on 30 Oct 2020  路  9Comments  路  Source: wix/react-native-calendars

At the time of creating the post, it was Friday 30th. For some reason, my calendar displays this day as Saturday:

<Calendar style={{width: Dimensions.get('screen').width - 10}} theme={{ selectedDayBackgroundColor: '#00adf5', selectedDayTextColor: '#ffffff', dotColor: '#00adf5', }} onDayPress={this.onDaySelect} markedDates={this.state.markedDates} markingType="single" minDate={minDate} maxDate={maxDate} disableAllTouchEventsForDisabledDays={true} />

Screen Shot 2020-10-30 at 16 59 43

stale

Most helpful comment

@mparkhomenko
Go to this file location

react-native-calenders -> src -> calendar -> header -> index.js

and changed

let weekDaysNames = weekDayNames(this.props.firstDay);
to 
let weekDaysNames = weekDayNames(6);

I have faced the same issue
I have resolved this issue from the above solution

All 9 comments

This is likely a UTC issue where you're local time is now "tomorrow" in UTC. You should set the current property to today's date string. In my own, I use it like this:

const date = new Date();

<Calendar 
    current={date.toLocaleDateString()}
    ... // other props
/>

@lostchopstik Thank you for your help, but It doesn't work for me :(
console.log(new Date().toLocaleDateString()); shows 10/31/2020 (current date). console.log(new Date()); also shows current date (Sat Oct 31 2020 10:41:14 GMT+0300 (Moscow Standard Time)), but in calendar I also see incorrect variant.

Screen Shot 2020-10-31 at 10 46 21

I have faced same issues. Please help me

@mparkhomenko Please added parameters firstDay={6}.

@jaiminp-nimblechapps It didn't help :(
Do you have other variants?

@mparkhomenko
Go to this file location

react-native-calenders -> src -> calendar -> header -> index.js

and changed

let weekDaysNames = weekDayNames(this.props.firstDay);
to 
let weekDaysNames = weekDayNames(6);

I have faced the same issue
I have resolved this issue from the above solution

@jaiminp-nimblechapps thank you!!!

@mparkhomenko Glad to help!!!!

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

matieux picture matieux  路  4Comments

akhilsanker picture akhilsanker  路  4Comments

filippoitaliano picture filippoitaliano  路  3Comments

anishtr4 picture anishtr4  路  3Comments

AleksandrZhukov picture AleksandrZhukov  路  3Comments