annotate src/core/date.cc @ 404:e561b7542b7b

*: fix build on mac os x
author Paper <paper@tflc.us>
date Mon, 19 Jan 2026 20:50:40 -0500
parents 1e5d922fe82b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
1 #include "core/date.h"
369
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
2 #include "core/json.h"
319
d928ec7b6a0d services/kitsu: implement GetAnimeList()
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
3 #include "core/time.h"
187
9613d72b097e *: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents: 175
diff changeset
4
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
5 #include <QDate>
51
75c804f713b2 window: add about window,
Paper <mrpapersonic@gmail.com>
parents: 47
diff changeset
6 #include <QDebug>
187
9613d72b097e *: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents: 175
diff changeset
7
63
3d2decf093bb *: fix many clang warnings
Paper <mrpapersonic@gmail.com>
parents: 51
diff changeset
8 #include <algorithm>
404
e561b7542b7b *: fix build on mac os x
Paper <paper@tflc.us>
parents: 389
diff changeset
9 #include <sstream>
317
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
10 #include <cstdio>
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
11
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
12 /* An implementation of AniList's "fuzzy date" */
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
13
369
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
14 Date::Date()
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
15 {
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
16 }
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
17
369
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
18 Date::Date(Date::Year y)
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
19 {
11
fc1bf97c528b *: use C++11 standard
Paper <mrpapersonic@gmail.com>
parents: 10
diff changeset
20 SetYear(y);
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
21 }
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
22
369
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
23 Date::Date(Date::Year y, Date::Month m, Date::Day d)
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
24 {
11
fc1bf97c528b *: use C++11 standard
Paper <mrpapersonic@gmail.com>
parents: 10
diff changeset
25 SetYear(y);
fc1bf97c528b *: use C++11 standard
Paper <mrpapersonic@gmail.com>
parents: 10
diff changeset
26 SetMonth(m);
fc1bf97c528b *: use C++11 standard
Paper <mrpapersonic@gmail.com>
parents: 10
diff changeset
27 SetDay(d);
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
28 }
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
29
369
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
30 Date::Date(const std::string &str)
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
31 {
317
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
32 unsigned int y, m, d;
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
33
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
34 /* I don't like this that much, but it works... */
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
35 int amt = std::sscanf(str.c_str(), "%4u-%2u-%2u", &y, &m, &d);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
36
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
37 if (amt > 0)
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
38 SetYear(y);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
39
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
40 if (amt > 1)
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
41 SetMonth(static_cast<Date::Month>(m - 1));
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
42
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
43 if (amt > 2)
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
44 SetDay(d);
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
45 }
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
46
369
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
47 Date::Date(const QDate &date)
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
48 {
51
75c804f713b2 window: add about window,
Paper <mrpapersonic@gmail.com>
parents: 47
diff changeset
49 SetYear(date.year());
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 198
diff changeset
50 auto m = date.month();
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 198
diff changeset
51 m = std::clamp(m, static_cast<decltype(m)>(Date::Month::Jan), static_cast<decltype(m)>(Date::Month::Dec));
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 198
diff changeset
52 SetMonth(static_cast<Date::Month>(m));
51
75c804f713b2 window: add about window,
Paper <mrpapersonic@gmail.com>
parents: 47
diff changeset
53 SetDay(date.day());
75c804f713b2 window: add about window,
Paper <mrpapersonic@gmail.com>
parents: 47
diff changeset
54 }
75c804f713b2 window: add about window,
Paper <mrpapersonic@gmail.com>
parents: 47
diff changeset
55
369
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
56 Date::Date(const nlohmann::json &json)
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
57 {
175
9b10175be389 dep/json: update to v3.11.3
Paper <mrpapersonic@gmail.com>
parents: 174
diff changeset
58 /* NOTE: this constructor is made for use with
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 198
diff changeset
59 * AniList FuzzyDate-style JSON. In the future, some other
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 198
diff changeset
60 * methods may be parsed and whatnot if necessary. */
198
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 197
diff changeset
61
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 197
diff changeset
62 if (json.contains("/year"_json_pointer) && json.at("/year"_json_pointer).is_number())
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 197
diff changeset
63 SetYear(json.at("/year"_json_pointer).get<unsigned int>());
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 198
diff changeset
64
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 198
diff changeset
65 if (json.contains("/month"_json_pointer) && json.at("/month"_json_pointer).is_number()) {
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 198
diff changeset
66 auto m = json.at("/month"_json_pointer).get<unsigned int>();
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 198
diff changeset
67 m = std::clamp(m, static_cast<decltype(m)>(Date::Month::Jan), static_cast<decltype(m)>(Date::Month::Dec));
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 198
diff changeset
68 SetMonth(static_cast<Date::Month>(m));
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 198
diff changeset
69 }
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 198
diff changeset
70
198
bc1ae1810855 dep/animia: switch from using classes to global functions
Paper <mrpapersonic@gmail.com>
parents: 197
diff changeset
71 if (json.contains("/day"_json_pointer) && json.at("/day"_json_pointer).is_number())
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 198
diff changeset
72 SetDay(json.at("/day"_json_pointer).get<unsigned char>());
174
f88eda79c60a anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
73 }
f88eda79c60a anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
74
369
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
75 Date::Date(Time::Timestamp timestamp)
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
76 {
319
d928ec7b6a0d services/kitsu: implement GetAnimeList()
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
77 Date(QDateTime::fromSecsSinceEpoch(timestamp).date());
d928ec7b6a0d services/kitsu: implement GetAnimeList()
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
78 }
d928ec7b6a0d services/kitsu: implement GetAnimeList()
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
79
369
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
80 void Date::VoidYear()
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
81 {
196
f0ff06a45c42 date: use std::optional for values
Paper <mrpapersonic@gmail.com>
parents: 187
diff changeset
82 year.reset();
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
83 }
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
84
369
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
85 void Date::VoidMonth()
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
86 {
196
f0ff06a45c42 date: use std::optional for values
Paper <mrpapersonic@gmail.com>
parents: 187
diff changeset
87 month.reset();
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
88 }
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
89
369
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
90 void Date::VoidDay()
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
91 {
196
f0ff06a45c42 date: use std::optional for values
Paper <mrpapersonic@gmail.com>
parents: 187
diff changeset
92 day.reset();
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
93 }
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
94
369
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
95 void Date::SetYear(Date::Year y)
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
96 {
197
c4ca035c565d *: misc. patches
Paper <mrpapersonic@gmail.com>
parents: 196
diff changeset
97 year.emplace(y);
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
98 }
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
99
369
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
100 void Date::SetMonth(Date::Month m)
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
101 {
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 198
diff changeset
102 month.emplace(m);
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
103 }
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
104
369
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
105 void Date::SetDay(Date::Day d)
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
106 {
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 198
diff changeset
107 day.emplace(std::clamp(d, static_cast<Date::Day>(1U), static_cast<Date::Day>(31U)));
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
108 }
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
109
369
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
110 std::optional<Date::Year> Date::GetYear() const
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
111 {
197
c4ca035c565d *: misc. patches
Paper <mrpapersonic@gmail.com>
parents: 196
diff changeset
112 return year;
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
113 }
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
114
369
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
115 std::optional<Date::Month> Date::GetMonth() const
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
116 {
197
c4ca035c565d *: misc. patches
Paper <mrpapersonic@gmail.com>
parents: 196
diff changeset
117 return month;
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
118 }
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
119
369
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
120 std::optional<Date::Day> Date::GetDay() const
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
121 {
197
c4ca035c565d *: misc. patches
Paper <mrpapersonic@gmail.com>
parents: 196
diff changeset
122 return day;
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
123 }
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
124
369
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
125 bool Date::IsValid() const
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
126 {
196
f0ff06a45c42 date: use std::optional for values
Paper <mrpapersonic@gmail.com>
parents: 187
diff changeset
127 return year.has_value() && month.has_value() && day.has_value();
47
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
128 }
d8eb763e6661 information.cpp: add widgets to the list tab, and add an
Paper <mrpapersonic@gmail.com>
parents: 36
diff changeset
129
369
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
130 QDate Date::GetAsQDate() const
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
131 {
187
9613d72b097e *: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents: 175
diff changeset
132 /* QDate doesn't support "missing" values (for good reason),
9613d72b097e *: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents: 175
diff changeset
133 * so we do our best and return what we can.
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 198
diff changeset
134 */
187
9613d72b097e *: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents: 175
diff changeset
135
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 198
diff changeset
136 return QDate(year.value_or(2000), static_cast<unsigned int>(month.value_or(Date::Month::Jan)), day.value_or(1));
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
137 }
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
138
369
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
139 nlohmann::json Date::GetAsAniListJson() const
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 319
diff changeset
140 {
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 198
diff changeset
141 nlohmann::json json = {
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 198
diff changeset
142 {"year", nullptr},
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 198
diff changeset
143 {"month", nullptr},
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 198
diff changeset
144 {"day", nullptr}
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 198
diff changeset
145 };
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 198
diff changeset
146
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 198
diff changeset
147 if (year)
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 198
diff changeset
148 json["year"] = static_cast<unsigned int>(year.value());
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 198
diff changeset
149
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 198
diff changeset
150 if (month)
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 198
diff changeset
151 json["month"] = static_cast<unsigned char>(month.value());
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 198
diff changeset
152
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 198
diff changeset
153 if (day)
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 198
diff changeset
154 json["day"] = static_cast<unsigned char>(day.value());
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 198
diff changeset
155
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 198
diff changeset
156 return json;
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
157 }
389
1e5d922fe82b kitsu: implement UpdateAnimeEntry
Paper <paper@tflc.us>
parents: 369
diff changeset
158
1e5d922fe82b kitsu: implement UpdateAnimeEntry
Paper <paper@tflc.us>
parents: 369
diff changeset
159 std::string Date::GetAsISO8601() const
1e5d922fe82b kitsu: implement UpdateAnimeEntry
Paper <paper@tflc.us>
parents: 369
diff changeset
160 {
1e5d922fe82b kitsu: implement UpdateAnimeEntry
Paper <paper@tflc.us>
parents: 369
diff changeset
161 std::stringstream res;
1e5d922fe82b kitsu: implement UpdateAnimeEntry
Paper <paper@tflc.us>
parents: 369
diff changeset
162
1e5d922fe82b kitsu: implement UpdateAnimeEntry
Paper <paper@tflc.us>
parents: 369
diff changeset
163 res << year.value_or(2000);
1e5d922fe82b kitsu: implement UpdateAnimeEntry
Paper <paper@tflc.us>
parents: 369
diff changeset
164 res << '-';
1e5d922fe82b kitsu: implement UpdateAnimeEntry
Paper <paper@tflc.us>
parents: 369
diff changeset
165 res << (static_cast<int>(month.value_or(Date::Month::Jan)) + 1);
1e5d922fe82b kitsu: implement UpdateAnimeEntry
Paper <paper@tflc.us>
parents: 369
diff changeset
166 res << '-';
1e5d922fe82b kitsu: implement UpdateAnimeEntry
Paper <paper@tflc.us>
parents: 369
diff changeset
167 res << day.value_or(1);
1e5d922fe82b kitsu: implement UpdateAnimeEntry
Paper <paper@tflc.us>
parents: 369
diff changeset
168
1e5d922fe82b kitsu: implement UpdateAnimeEntry
Paper <paper@tflc.us>
parents: 369
diff changeset
169 /* fake the rest... */
1e5d922fe82b kitsu: implement UpdateAnimeEntry
Paper <paper@tflc.us>
parents: 369
diff changeset
170 res << "T00:00:00.000Z";
1e5d922fe82b kitsu: implement UpdateAnimeEntry
Paper <paper@tflc.us>
parents: 369
diff changeset
171
1e5d922fe82b kitsu: implement UpdateAnimeEntry
Paper <paper@tflc.us>
parents: 369
diff changeset
172 return res.str();
1e5d922fe82b kitsu: implement UpdateAnimeEntry
Paper <paper@tflc.us>
parents: 369
diff changeset
173 }