forked from HowardHinnant/date
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[API BREAKING] Remove conversion from weekday to unsigned
* There has been a great deal of anguish over the encoding of weekdays: whether [0, 6] maps to [Sunday, Saturday] or [1, 7] maps to [Monday, Sunday]. This commit attempts to address that issue, but will break a small amount of code at compile-time. See below on how to fix that. * The weekday constructor used to accept [0, 6] to represent [Sunday, Saturday]. It now accepts [0, 7] to represent [Sunday, Saturday] with both 0 and 7 mapping to Sunday. * The conversion from weekday to unsigned has been removed. * To convert a weekday to unsigned replace: auto u = unsigned{wd}; with: auto u = (wd - Sunday).count(); This maps [Sunday, Saturday] to [0, 6], which is the C/POSIX mapping. If you prefer the ISO mapping ([Monday, Sunday] -> [1, 7]), then do: auto u = (wd - Monday).count() + 1;
- Loading branch information
1 parent
6c4d333
commit 40b8365
Showing
4 changed files
with
34 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters