React-dates: isDayBlocked -rendering issue

Created on 9 Apr 2018  路  2Comments  路  Source: airbnb/react-dates

screen shot 2018-04-09 at 12 09 42
screen shot 2018-04-09 at 12 09 48

In this example April 9th seems greyed out. Either way user is still able to select the date and like other picture of console shows, isDayBlocked function returns false.

import's

import 'react-dates/initialize' // <---- put this at the very top of your js file

import ThemedStyleSheet from 'react-with-styles/lib/ThemedStyleSheet'
import aphroditeInterface from 'react-with-styles-interface-aphrodite'
import DefaultTheme from 'react-dates/lib/theme/DefaultTheme'

ThemedStyleSheet.registerInterface(aphroditeInterface)
ThemedStyleSheet.registerTheme({
  reactDates: {
    ...DefaultTheme.reactDates,
    color: {
      ...DefaultTheme.reactDates.color,
      backgroundColor: '#333',
    },
  },
})
needs react-dateinitialize question

Most helpful comment

edit: Seemed to be issue with timezones. isDayBlocked -functions prop day -moment object gave datetime as 2018-04-09T00:00:00+03:00, and I compared it to UTC times. I believe result was that, expected time was then translated to be relatively yesterday. Works as expected!

Something like forcing moment object hours to always 12 works in this example.

All 2 comments

You only need the initialize endpoint if you鈥檙e not registering your own theme and interface; try removing that line?

edit: Seemed to be issue with timezones. isDayBlocked -functions prop day -moment object gave datetime as 2018-04-09T00:00:00+03:00, and I compared it to UTC times. I believe result was that, expected time was then translated to be relatively yesterday. Works as expected!

Something like forcing moment object hours to always 12 works in this example.

Was this page helpful?
0 / 5 - 0 ratings