mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:17:44 +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
1 changed files with 2 additions and 2 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue