| 123456789101112131415161718192021222324252627282930313233343536 |
- /* ************************************************************************** */
- /* */
- /* ::: :::::::: */
- /* Date.cpp :+: :+: :+: */
- /* +:+ +:+ +:+ */
- /* By: bchanot <bchanot@42.fr> +#+ +:+ +#+ */
- /* +#+#+#+#+#+ +#+ */
- /* Created: 2026/01/16 18:06:10 by bchanot #+# #+# */
- /* Updated: 2026/01/16 19:34:38 by bchanot ### ########.fr */
- /* */
- /* ************************************************************************** */
- #include <iomanip>
- #include "Date.hpp"
- bool operator<(const Date &a, const Date &b) {
- if (a.year != b.year)
- return a.year < b.year;
- if (a.month != b.month)
- return a.month < b.month;
- return a.day < b.day;
- }
- bool operator==(const Date &a, const Date &b) {
- return a.year == b.year && a.month == b.month && a.day == b.day;
- }
- bool operator!=(const Date &a, const Date &b) {
- return !(a == b);
- }
- std::ostream &operator<<(std::ostream &o, const Date &date) {
- o << date.year << "-" << std::setw(2) << std::setfill('0') << date.month << "-" << std::setw(2) << std::setfill('0') << date.day << std::setfill(' ');;
- return o;
- }
|