question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Start week from Monday instead of Sunday? (localizer not working)

See original GitHub issue

I’m not sure but this seems that it’s not working anymore and there is a bit of inconsistency from docs and github repo.

In the docs http://intljusticemission.github.io/react-big-calendar/examples/index.html#intro

import BigCalendar from 'react-big-calendar';
import moment from 'moment';

// Setup the localizer by providing the moment (or globalize) Object
// to the correct localizer.
BigCalendar.momentLocalizer(moment); // or globalizeLocalizer

I tried this also with moment.locale('en-GB') before passing the object.

Then I checked the master repo and seems different:

BigCalendar.setLocalizer(
  BigCalendar.momentLocalizer(moment)
);

Both of them are not working for me anyway, the week is always starting on Sunday when it’s supposed to start on Monday.

Which one is supposed to be correct?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:16 (4 by maintainers)

github_iconTop GitHub Comments

42reactions
mtt87commented, Jun 5, 2017

Found the issue, for some reason using webpack it’s not importing the locales so it always default to en which is en-us not en-gb

This is the fix:

import moment from 'moment';
import 'moment/locale/en-gb';
9reactions
danadncommented, Jul 29, 2018

for me only the following worked:

import moment from 'moment';
import BigCalendar from 'react-big-calendar';
moment.locale("es-es", {
	week: {
		dow: 1 //Monday is the first day of the week.
	}
});
BigCalendar.setLocalizer(BigCalendar.momentLocalizer(moment));
Read more comments on GitHub >

github_iconTop Results From Across the Web

react big calendar start week from monday instead of sunday?
momentLocalizer (moment);. So the full extract looks something like: import moment from 'moment'; import ...
Read more >
change start week day as Monday instead of Sunday ...
Current change calendar view starts from Sunday and end with Saturday. It need to be changed to start week day as Monday instead...
Read more >
Localization for .NET; Chapter 3: Week Numbers
The ISO week always starts on Monday. The first week of the year is either calculated by finding the first of January or...
Read more >
#145146 Localization: switch week/month start day, define ...
I would like to switch week start day from sunday to monday. Dropdown calendars display weeks starting with Sundays and that is pretty...
Read more >
About Big Calendar - Page ⋅ Storybook
Date internationalization and localization is hard and Big Calendar doesn't even attempt to solve that problem. Instead you can use one of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found