1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 03:47:34 +00:00

LibJS: Use AK::NaN<double> in Date::date_value() to fix build error

This was not happening locally for me, neither when building Lagom on
Linux nor with the SerenityOS toolchain...

    error: implicit conversion from ‘float’ to ‘double’ to match other
    result of conditional [-Werror=double-promotion]
This commit is contained in:
Linus Groh 2021-12-10 23:32:54 +00:00
parent de00a7594f
commit aa2b85c697

View file

@ -6,6 +6,7 @@
#pragma once #pragma once
#include <AK/Math.h>
#include <LibCore/DateTime.h> #include <LibCore/DateTime.h>
#include <LibJS/Runtime/Object.h> #include <LibJS/Runtime/Object.h>
@ -78,7 +79,7 @@ public:
double date_value() const double date_value() const
{ {
return m_is_invalid return m_is_invalid
? NAN ? AK::NaN<double>
: static_cast<double>(m_datetime.timestamp() * 1000 + m_milliseconds); : static_cast<double>(m_datetime.timestamp() * 1000 + m_milliseconds);
} }