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

Start of week on Monday instead of Sunday #74

Closed
EverCodeAP opened this issue Dec 21, 2017 · 1 comment
Closed

Start of week on Monday instead of Sunday #74

EverCodeAP opened this issue Dec 21, 2017 · 1 comment

Comments

@EverCodeAP
Copy link

I'd like to call dateFor(.startOfWeek) and get Monday's date instead of Sunday's. Same thing with .endOfWeek - Sunday instead of Saturday.
Is there any way to configure this library this way or is it completely dependent on phone settings or something?

@melvitax
Copy link
Owner

melvitax commented Jan 8, 2018

This function now uses a calendar's start of week to calculate the start of the week. You can pass it a custom calendar that has this setting or rely on the current user's calendar setting.

var calendar = Calendar(identifier: .gregorian) calendar = 2 // sets the week to start on the second day.. Monday now.dateFor(.startOfWeek, calendar: calendar)

@melvitax melvitax closed this as completed Jan 8, 2018
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

No branches or pull requests

2 participants