Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Generic / Date / Date.cpp
diff options
context:
space:
mode:
1 files changed, 7 insertions, 6 deletions
-rw-r--r--src/Generic/Date/Date.cpp13
diff --git a/src/Generic/Date/Date.cpp b/src/Generic/Date/Date.cpp
index 44080c1..c5eeb9d 100644
--- a/src/Generic/Date/Date.cpp
+++ b/src/Generic/Date/Date.cpp
@@ -22,19 +22,20 @@ Date::Date() : Date(01, 05, 2022) {}
Date::Date(const char* str) {
while (*str == ' ' && *str != '\0') str++;
- day = atoi(str);
+ set_day(atoi(str));
str += 2;
while (*str == ' ' && *str != '\0') str++;
- month = atoi(str);
+ set_month(atoi(str));
str += 2;
while (*str == ' ' && *str != '\0') str++;
- year = atoi(str);
+ set_year(atoi(str));
}
Date::Date(unsigned short day, unsigned short month, unsigned short year) {
- this->day = day;
- this->month = month;
- this->year = year;
+ this->day = this->month = this->year = 0;
+ set_day(day);
+ set_month(month);
+ set_year(year);
}
unsigned short Date::get_day() const {