3#ifndef TETL_CHRONO_YEAR_MONTH_WEEKDAY_HPP
4#define TETL_CHRONO_YEAR_MONTH_WEEKDAY_HPP
35 [[nodiscard]]
constexpr auto year() const noexcept ->
chrono::
year {
return _y; }
38 [[nodiscard]]
constexpr auto index() const noexcept ->
unsigned {
return _wdi.index(); }
41 [[nodiscard]]
constexpr auto ok() const noexcept ->
bool
43 if (not _y.ok() or not _m.ok() or not _wdi.weekday().ok() or _wdi.index() < 1) {
46 if (_wdi.index() <= 4) {
50 auto d2 = _wdi.weekday() - firstOfMonth +
days(
static_cast<int_least32_t>((_wdi.index() - 1) * 7 + 1));
51 return static_cast<unsigned>(d2.count()) <=
static_cast<unsigned>((_y / _m / last).day());
54 [[nodiscard]]
constexpr operator sys_days() const noexcept;
55 [[nodiscard]] constexpr explicit operator
local_days() const noexcept;
65 return lhs.year() == rhs.year() and lhs.month() == rhs.month() and lhs.weekday_indexed() == rhs.weekday_indexed();
70 auto const ym =
year_month{lhs.year(), lhs.month()} + rhs;
71 return {ym.year(), ym.month(), lhs.weekday_indexed()};
local_time< etl::chrono::days > local_days
Definition local_t.hpp:27
constexpr auto operator+(day const &d, days const &ds) noexcept -> day
Definition day.hpp:92
duration< int_least32_t, ratio< 31556952 > > months
Signed integer type of at least 20 bits.
Definition duration.hpp:371
duration< int_least32_t, ratio< 86400 > > days
Signed integer type of at least 25 bits.
Definition duration.hpp:365
sys_time< chrono::days > sys_days
Definition system_clock.hpp:39
duration< int_least32_t, ratio< 2629746 > > years
Signed integer type of at least 17 bits.
Definition duration.hpp:374
constexpr auto operator-(day const &d, days const &ds) noexcept -> day
Definition day.hpp:102
TETL_BUILTIN_INT32 int_least32_t
Signed integer type with width of at least 32 bits.
Definition int_least_t.hpp:17
The class month represents a month in a year.
Definition month.hpp:21
Definition weekday_indexed.hpp:11
Definition weekday.hpp:18
Definition year_month_weekday.hpp:16
constexpr auto index() const noexcept -> unsigned
Definition year_month_weekday.hpp:38
constexpr year_month_weekday(chrono::year const &y, chrono::month const &m, chrono::weekday_indexed const &wdi) noexcept
Definition year_month_weekday.hpp:19
constexpr auto ok() const noexcept -> bool
Definition year_month_weekday.hpp:41
constexpr auto weekday_indexed() const noexcept -> chrono::weekday_indexed
Definition year_month_weekday.hpp:39
constexpr auto month() const noexcept -> chrono::month
Definition year_month_weekday.hpp:36
constexpr auto weekday() const noexcept -> chrono::weekday
Definition year_month_weekday.hpp:37
constexpr auto operator-=(months const &m) noexcept -> year_month_weekday &
constexpr year_month_weekday(sys_days const &dp) noexcept
constexpr auto operator-=(years const &y) noexcept -> year_month_weekday &
year_month_weekday()=default
constexpr auto year() const noexcept -> chrono::year
Definition year_month_weekday.hpp:35
constexpr year_month_weekday(local_days const &dp) noexcept
constexpr auto operator+=(years const &y) noexcept -> year_month_weekday &
constexpr auto operator+=(months const &m) noexcept -> year_month_weekday &
Definition year_month.hpp:11