Skip to content
Merged
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
6 changes: 3 additions & 3 deletions include/jwt-cpp/jwt.h
Original file line number Diff line number Diff line change
Expand Up @@ -2625,15 +2625,15 @@ namespace jwt {
/**
* \brief Get the contained JSON value as a date
*
* If the value is a decimal, it is rounded up to the closest integer
* If the value is a decimal, it is rounded to the closest integer
*
* \return content as date
* \throw std::bad_cast Content was not a date
*/
date as_date() const {
using std::chrono::system_clock;
if (get_type() == json::type::number) return system_clock::from_time_t(std::round(as_number()));
return system_clock::from_time_t(as_integer());
if (get_type() == json::type::number) return system_clock::from_time_t(static_cast<std::time_t>(std::round(as_number())));
return system_clock::from_time_t(static_cast<std::time_t>(as_integer()));
}

/**
Expand Down
Loading