15 Commits

Author SHA1 Message Date
Howard Hinnant
40b83654b6 [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;
2018-06-02 22:56:10 -04:00
Howard Hinnant
c513a20691 Fix off-by-one bug in iso_week::year_lastweek_weekday
* The conversion from year_lastweek_weekday to sys_days
  and local_days had an off by one error.
* Added test for this case.
2017-11-30 10:28:14 -05:00
Howard Hinnant
6fe8b4b7f3 Update copyright to 2016 2016-05-30 22:21:08 -04:00
Howard Hinnant
ea2d0d3357 constexpr more stuff and clean up whitespace 2016-05-30 22:09:21 -04:00
Howard Hinnant
76c906d779 Get off of day_point 2016-05-21 10:24:25 -04:00
Howard Hinnant
d49afb8a30 Add test for date composition operators 2015-12-23 13:20:08 -05:00
Howard Hinnant
270b8554f5 Test year_lastweek_weekday 2015-12-22 19:48:11 -05:00
Howard Hinnant
edc3aee402 Test year_weeknum_weekday 2015-12-22 19:08:16 -05:00
Howard Hinnant
fe8fc38d7a Test lastweek_weekday 2015-12-22 17:59:28 -05:00
Howard Hinnant
099c068dcf Test weeknum_weekday 2015-12-22 15:58:04 -05:00
Howard Hinnant
8b885976bc Add test for year_lastweek 2015-12-22 15:37:53 -05:00
Howard Hinnant
b2203746d9 Add test for iso_week::year_weeknum. 2015-12-22 15:12:51 -05:00
Howard Hinnant
d5b26a8796 Tests for iso_week::year 2015-12-21 22:13:23 -05:00
Howard Hinnant
906f5eb4f9 Tests for iso_week::weeknum 2015-12-21 21:33:50 -05:00
Howard Hinnant
e10c55d4a6 Intitial ios_week tests 2015-12-21 20:27:57 -05:00