tangled
alpha
login
or
join now
yoten.app
/
yoten
17
fork
atom
Yōten: A social tracker for your language learning journey built on the atproto.
17
fork
atom
overview
issues
pulls
pipelines
fix: date picker timezone bias
brookjeynes.dev
5 months ago
43a8bc1b
250d6a19
verified
This commit was signed with the committer's
known signature
.
brookjeynes.dev
SSH Key Fingerprint:
SHA256:N3n3PCBSiXfS6EHlmGdx+LMEruJMj6FS2hqaXyfsw0s=
+17
-4
3 changed files
expand all
collapse all
unified
split
internal
db
stats.go
server
views
edit-study-session.templ
new-study-session.templ
+1
internal/db/stats.go
···
135
135
return 0, nil
136
136
}
137
137
138
138
+
// TODO: This should be calculated in users timezone.
138
139
now := time.Now().UTC()
139
140
today := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.UTC)
140
141
yesterday := today.AddDate(0, 0, -1)
+8
-2
internal/server/views/edit-study-session.templ
···
279
279
</div>
280
280
<div
281
281
x-data="{
282
282
-
today: (d => d.toISOString().slice(0,10))(new Date()),
283
283
-
oneYearAgo: (d => d.toISOString().slice(0,10))(new Date(new Date().setFullYear(new Date().getFullYear() - 1)))
282
282
+
today: () => {
283
283
+
let date = new Date();
284
284
+
return new Date(date.getTime() - (date.getTimezoneOffset() * 60000)).toISOString().slice(0,10);
285
285
+
},
286
286
+
oneYearAgo: () => {
287
287
+
let date = new Date(new Date().setFullYear(new Date().getFullYear() - 1));
288
288
+
return new Date(date.getTime() - (date.getTimezoneOffset() * 60000)).toISOString().slice(0,10);
289
289
+
},
284
290
}"
285
291
class="flex flex-col gap-2"
286
292
>
+8
-2
internal/server/views/new-study-session.templ
···
334
334
</div>
335
335
<div
336
336
x-data="{
337
337
-
today: (d => d.toISOString().slice(0,10))(new Date()),
338
338
-
oneYearAgo: (d => d.toISOString().slice(0,10))(new Date(new Date().setFullYear(new Date().getFullYear() - 1)))
337
337
+
today: () => {
338
338
+
let date = new Date();
339
339
+
return new Date(date.getTime() - (date.getTimezoneOffset() * 60000)).toISOString().slice(0,10);
340
340
+
},
341
341
+
oneYearAgo: () => {
342
342
+
let date = new Date(new Date().setFullYear(new Date().getFullYear() - 1));
343
343
+
return new Date(date.getTime() - (date.getTimezoneOffset() * 60000)).toISOString().slice(0,10);
344
344
+
},
339
345
}"
340
346
x-show="mode === 'manual'"
341
347
x-transition