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.

StartOf('week') always return Monday

See original GitHub issue

I been creating a calendar by using date from luxon. My calendar has a feature to change the background of each date box if it .hasSame(d, 'weeks') return true. let say today is 18 May my expectation when I call hasSame(d, 'weeks') is to return true on 16 May to 22 May but actual is 17 May to 23 May have been highlighted.

Anyone can help me to correct the result and what API should I call. I been tried .set({{ weekday: 7}) still got a same result Screen Shot 2564-05-18 at 14 00 16

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
icambroncommented, May 18, 2021

Luxon uses the ISO week calendar, where weeks start on Monday.

We’d love to support local weeks, but the Intl API doesn’t currently have the ability to tell us when, say, Germany starts its weeks. The relevant proposal is here: https://github.com/tc39/proposal-intl-locale-info

0reactions
Wernfriedcommented, Oct 3, 2022

Think about it for a second. May 16 in this case would be day of a last week. But I heard that Germany considers Sunday to be the first day of the week. So maybe try .setLocale(‘de’) or smth.

That’s clearly not the case. In Germany week starts on Monday, according to standard EN 28601 which is according to ISO 8601. But it also shows, this is not a trivial topic.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Starting the week on Monday with isoWeekday()
startOf ('week') returns Sunday (of the past Week) and setting it then to Monday sets it one week to early. – Christian. Feb...
Read more >
How to find beginning/start of week by any given date in Excel?
(1) This formula =A2-MOD(A2-2,7) will return Monday as the beginning of week based on the given date. For returning Sunday as the start...
Read more >
Get Monday of the week - Excel formula | Exceljet
WEEKDAY returns a number, normally 1-7 for each day of the week. By setting the optional second argument (return_type) to 3, WEEKDAY will...
Read more >
M language - Start of week is Sunday not Monday - Query Editor
StartOfWeek ([Date],firstDayofWeek), type date). I want to change it to recognise Sunday as the first day of the week instead of Monday.
Read more >
Date & Time Functions - Snowflake Documentation
As defined in the ISO 8601 standard (for dates and time formats), ISO weeks always start on Monday and “belong” to the year...
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