Skip to content

Calendar - Header: Month Year vs Date + timestamp #2615

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
erie-e9 opened this issue Mar 8, 2025 · 2 comments
Open

Calendar - Header: Month Year vs Date + timestamp #2615

erie-e9 opened this issue Mar 8, 2025 · 2 comments

Comments

@erie-e9
Copy link

erie-e9 commented Mar 8, 2025

Hey guys I'm experiencing an issue in Calendar, header's date text changed to second image below. I prefer old one, is there a way to change it back? I prefer old way for now. I already have localization config but I won't add extra localize config for it.

Documentation
Image

New style?
Image

Code:

<Calendar
        testID={`${testID}Calendar`}
        current={reFormatDate(selected || maxDate || current || todayValue, 'YYYY-MM-DD')}
        initialDate={reFormatDate(selected || maxDate || todayValue, 'YYYY-MM-DD')}
        maxDate={reFormatDate(maxDate || todayValue, 'YYYY-MM-DD')}
        minDate={reFormatDate(minDate || todayValue, 'YYYY-MM-DD')}
        allowSelectionOutOfRange={allowSelectionOutOfRange}
        disableAllTouchEventsForDisabledDays={disableAllTouchEventsForDisabledDays}
        disableAllTouchEventsForInactiveDays={disableAllTouchEventsForInactiveDays}
        onDayPress={(date: any) => onSelect(date)}
        markedDates={markedDates}
        firstDay={firstDay}
        enableSwipeMonths={true}
        // showWeekNumbers
        hideExtraDays
        disabledDaysIndexes={[0, 6]}
        theme={{
          backgroundColor: 'yellow', // no works
          calendarBackground: theme.tokens.colors.tertiary50,
          textSectionTitleColor: theme.tokens.colors.tertiary700, // color's day of week
          textSectionTitleDisabledColor: theme.tokens.colors.tertiary400, // blocked color's day of week
          selectedDayBackgroundColor: theme.tokens.colors.primary500, // no works
          selectedDayTextColor: 'red', // no works
          todayTextColor: theme.tokens.colors.tertiary950,
          dayTextColor: theme.tokens.colors.primary500,
          textDisabledColor: theme.tokens.colors.tertiary400,
          monthTextColor: theme.tokens.colors.typography950, // header color
          indicatorColor: 'blue', // no works
          arrowColor: theme.tokens.colors.tertiary800,
          stylesheet: {
            calendar: {
              header: {
                marginTop: 30,
                marginHorizontal: 12,
                flexDirection: 'row',
                justifyContent: 'space-between',
                backgroundColor: 'red',
              },
            },
          },
        }}
        headerStyle={inlineStyleHeaderStyle}
      />
@Dallas62
Copy link

Dallas62 commented Mar 11, 2025

Looks likes it's due to defaultProps deprecation in recent React Native versions.

You can add the property: monthFormat="MMMM yyyy" in the <Calendar /> component to restore it back.

https://github.com/wix/react-native-calendars/blame/ed9b13b1ccc06d9382786fc02a85a401d8fa0bc8/src/calendar/header/index.tsx#L313

Looks like someone opened a PR last year, but not yet merged / validated.

#2480

@NorseGaud
Copy link

Thanks @Dallas62

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants