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.

Wrong week date range in calendar header when using week start as middle day of week

See original GitHub issue

Describe the bug

I am using below code to show week date range in week view header.

  <div class="col-md-4 text-center">
    <h3>{{ viewDate | calendarDate: view + 'ViewTitle':locale }}</h3>
  </div>

I have configured week view as below.

<mwl-calendar-week-view [hourSegments]="2" [weekStartsOn]="4" [viewDate]="viewDate"
	[events]="events" [dayStartHour]="6" [dayEndHour]="18">
</mwl-calendar-week-view>

Week start is Thursday and end is Wednesday. Week view calendar show the correct week start and end dates. But header component shows wrong date range for week.

Week range should be Jul 18 - Jul 24, 2019. But, as in the below image it displays as Jul 21 - Jul 27, 2019

How can I fix this?

Minimal reproduction of the problem with instructions

Here is the Stackblitz

Screenshots

image

Versions

  • @angular/core: 6.1.7
  • angular-calendar: 0.27.14
  • Browser name and version: Google Chrome Version 75.0.3770.142 (Official Build) (64-bit)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
mattlewis92commented, Jul 25, 2019

You need to pass the weekStartsOn as an argument to the calendarDate pipe, so that it knows about it:

<h3>{{ viewDate | calendarDate:(view + 'ViewTitle'):'en':4 }}</h3>

I’ll update the docs to make this more clear as it’s come up a few times now and it’s quite confusing.

3reactions
tvbishancommented, Jul 25, 2019

Thanks for the update. With this modification, now show the correct week date range in the header.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Wrong week date range in calendar header when ... - GitHub
Week start is Thursday and end is Wednesday. Week view calendar show the correct week start and end dates. But header component shows...
Read more >
Week starting on Monday - Tableau Community
Right click on the Data Source. 2. Navigate to Date Properties. 3. Here you can change Week Start day, Fiscal year start and...
Read more >
Set the first day of the calendar week and change calendar ...
By default, the work week is defined as Monday through Friday with a work day of 9 A.M. to 5 P.M. The first...
Read more >
Excel WEEKNUM function – convert week number to date and ...
Formula examples demonstrate how you can use the WEEKNUM function to calculate week numbers in Excel - convert week number to date, get...
Read more >
The Ultimate Guide To Google Calendar
The first general settings are straightforward. You can change the day on which you start the week, choose to use the device's time...
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