mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-16 12:52:46 +00:00
LibCore: Fix off-by-one in DateTime::{create,set_time} day default arg
Just like month, the day value here is one-based. This resulted in the following situation, which is obviously unexpected: Core::DateTime::create(1970); // 1970-01-00 -> 1969-12-31
This commit is contained in:
parent
e9f0ebd4bd
commit
232f54cd9b
|
@ -29,10 +29,10 @@ public:
|
|||
unsigned day_of_year() const;
|
||||
bool is_leap_year() const;
|
||||
|
||||
void set_time(int year, int month = 1, int day = 0, int hour = 0, int minute = 0, int second = 0);
|
||||
void set_time(int year, int month = 1, int day = 1, int hour = 0, int minute = 0, int second = 0);
|
||||
String to_string(const String& format = "%Y-%m-%d %H:%M:%S") const;
|
||||
|
||||
static DateTime create(int year, int month = 1, int day = 0, int hour = 0, int minute = 0, int second = 0);
|
||||
static DateTime create(int year, int month = 1, int day = 1, int hour = 0, int minute = 0, int second = 0);
|
||||
static DateTime now();
|
||||
static DateTime from_timestamp(time_t);
|
||||
static Optional<DateTime> parse(const String& format, const String& string);
|
||||
|
|
Loading…
Reference in a new issue