Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Generic / Date / Date.cpp
diff options
context:
space:
mode:
Commitde678e3a54bdcb776edb43179ff39e02ffb15d8e (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-08 18:43:35 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-08 18:43:40 +0300
Files3bc373d6e40ebe5b97dc5786bd1f5e5c10b62501 /src/Generic/Date/Date.cpp
FMI-OOP-P1_TicketSystem-de678e3a54bdcb776edb43179ff39e02ffb15d8e.tar
FMI-OOP-P1_TicketSystem-de678e3a54bdcb776edb43179ff39e02ffb15d8e.tar.gz
FMI-OOP-P1_TicketSystem-de678e3a54bdcb776edb43179ff39e02ffb15d8e.zip
Parent6996e0f3c6f379e3cd2dba758e5290265fce41e2 (diff)
Improved date constructors
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 {