react-day-picker icon indicating copy to clipboard operation
react-day-picker copied to clipboard

June 2015 is showing 6 weeks instead of 5

Open j03w opened this issue 11 years ago • 7 comments

Hi all,

Please see attached image:

screen shot 2015-05-29 at 4 22 00 pm

j03w avatar May 29 '15 06:05 j03w

@j03w on which browser? which locale are you using with moment?

gpbl avatar May 29 '15 07:05 gpbl

Yeah i can reproduce it with weeks starting on monday... working on a fix!

gpbl avatar May 29 '15 07:05 gpbl

mmh it's weird, @j03w could you help me to reproduce this bug? Are you passing the same localized dates to the component?

gpbl avatar May 29 '15 09:05 gpbl

Hi sorry for the late reply. I'm using Chrome 43.

The only thing I have for locale setting is this:

moment.locale('en', {
  week: {
    dow: 1
  }
});

My local timezone is GMT+10

I'm debugging it right now and I think I kind of get where the problem is originating from. Will keep you posted.

j03w avatar May 31 '15 00:05 j03w

OK so the problem for me is this: https://github.com/gpbl/react-day-picker/blob/master/src/CalendarUtils.js#L11

value for my firstOfMonth is Mon Jun 01 2015 00:00:00 GMT+1000 and that's Sun May 31 2015 14:00:00 GMT+0000

Remove conversion to UTC solved my issue plus it also resolved date selection issue that I'm having as well. I know this is a fix for #18 but clearly this create more problems than solving it...

j03w avatar May 31 '15 03:05 j03w

Hi @j03w I'm sorry for this issue, I've pushed a version which does not use the utc dates anymore. Version 1 (in progress) will have a full test suite that will help to prevent this kind of problems. Any thought about #27 ?

gpbl avatar May 31 '15 20:05 gpbl

thank you! @gpbl

j03w avatar Jun 01 '15 07:06 j03w