Skip to content

feat: add Saturday as first day of week option#5893

Open
mvanhorn wants to merge 1 commit into
kimai:mainfrom
mvanhorn:feat/4017-saturday-first-day
Open

feat: add Saturday as first day of week option#5893
mvanhorn wants to merge 1 commit into
kimai:mainfrom
mvanhorn:feat/4017-saturday-first-day

Conversation

@mvanhorn

Copy link
Copy Markdown

Summary

Adds Saturday as an option for the first day of the week, alongside the existing Monday and Sunday options. Useful for regions where the work week starts on Saturday.

Changes

  • src/Form/Type/FirstWeekDayType.php: Added 'Saturday' => 'saturday' to the choices array
  • src/Timesheet/DateTimeFactory.php: Refactored from bool $startOnSunday to string $firstDayOfWeek with match expressions for Monday/Sunday/Saturday week boundary calculations
  • src/Entity/User.php: Added isFirstDayOfWeekSaturday() method, kept isFirstDayOfWeekSunday() for backward compatibility
  • src/Command/InvoiceCreateCommand.php: Updated to pass $user->getFirstDayOfWeek() instead of $user->isFirstDayOfWeekSunday()

Backward compatibility

The isFirstDayOfWeekSunday() method is preserved. The DateTimeFactory constructor now accepts a string ('monday', 'sunday', 'saturday') instead of a boolean, but the default behavior ('monday') matches the previous default (false).

Fixes #4017

This contribution was developed with AI assistance (Codex).

@CLAassistant

CLAassistant commented Apr 10, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@kevinpapst

Copy link
Copy Markdown
Member

This contribution was developed with AI assistance (Codex).

Thank you for exposing the info. Did you check the code yourself?

Which regions use Saturday as first day of the week?

}

public function __construct(?DateTimeZone $timezone = null, bool $startOnSunday = false)
public function __construct(?DateTimeZone $timezone = null, string $firstDayOfWeek = 'monday')

@kevinpapst kevinpapst Apr 10, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a critical BC and needs to be changed. Make it bool|string and adjust the code accordingly. True = Sunday, False = Monday.
Also add a deprecation in case of bool.

@mvanhorn

Copy link
Copy Markdown
Author

Yes, I reviewed the changes. The match expressions in DateTimeFactory handle the Saturday boundary calculations the same way the existing Sunday path does, and the isFirstDayOfWeekSaturday() helper follows the same pattern as isFirstDayOfWeekSunday(). The bool $startOnSunday to string $firstDayOfWeek refactor is backward-compatible since getFirstDayOfWeek() already existed.

Saturday is the first day of the week in several countries, mostly in the Middle East and North Africa - Afghanistan, Egypt, Iran, Iraq, Libya, Qatar, and Somalia. The work week starts Saturday and Friday is the weekend (Islamic prayer day).

I'll sign the CLA now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Saturday to first day of the week

3 participants