Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make startOfWeek locale-aware by default #3831

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

hafizasad419
Copy link

@hafizasad419 hafizasad419 commented Jun 8, 2024

This pull request addresses the issue raised regarding the startOfWeek function's lack of default locale awareness. Currently, the function defaults to Sunday as the start of the week, which may not align with the conventions of all locales.

Problem Statement:

The current implementation of the startOfWeek function does not consider locale-specific conventions for determining the start of the week. This poses an inconvenience for users who rely on different start-of-week conventions based on their locale.

Proposed Solution:

To address this issue, I've modified the startOfWeek function to be locale-aware by default. Now, when no explicit locale is provided, the function will automatically determine the start of the week based on the locale settings. This enhancement improves usability and ensures that the function aligns with the expectations of users across different locales.

Comments from Issue:

The original issue highlighted the need for locale-aware behavior by default, citing the inconvenience of manually specifying the week start parameter based on locale.
Comments from other contributors acknowledged the workaround of manually specifying the locale but emphasized the importance of making the function more intuitive and efficient.

Changes Made:

Modified the startOfWeek function to check for the default locale if no explicit locale is provided.
Implemented logic to determine the start of the week based on the locale settings.
Updated the documentation to reflect the changes made to the function.

Test Coverage:

Added tests to ensure that the startOfWeek function behaves correctly with different locales.
Existing tests have been updated to accommodate the changes in behavior.

Related Issue: #3829

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Triaging
Development

Successfully merging this pull request may close these issues.

None yet

3 participants