Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/Wt/WDate.C
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ void WDate::setDate(int year, int month, int day)

void WDate::setYmd(int y, int m, int d)
{
ymd_ = (y << 16) | ((m & 0xFF) << 8) | (d & 0xFF);
ymd_ = static_cast<int>(
(static_cast<unsigned>(y) << 16) |
((static_cast<unsigned>(m) & 0xFF) << 8) |
(static_cast<unsigned>(d) & 0xFF));
}

bool WDate::isLeapYear(int year)
Expand Down
4 changes: 2 additions & 2 deletions src/Wt/WDate.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class WT_API WDate
*
* \sa isNull(), WDate(int, int, int), setDate()
*/
bool isValid() const { return ymd_ > 1; }
bool isValid() const { return ymd_ != 0 && ymd_ != 1; }

/*! \brief Returns the year.
*
Expand Down Expand Up @@ -447,7 +447,7 @@ class WT_API WDate
static RegExpInfo formatToRegExp(const WT_USTRING& format);

private:
unsigned ymd_;
int ymd_;

void setYmd(int year, int month, int day);

Expand Down