Read a post's date as the Berlin calendar day, not the raw UTC day
This commit is contained in:
1 parent
aef05fb090
commit
6d3260db49
6 files changed
+76
-8
No files matched your search
@@ -64,6 +64,20 @@ public sealed class PocketBaseClientTests(PocketBaseFixture pocketBase)
|
||||
posts.Select(p => p.Title).ShouldBe(["Neuer Vorstand", "Neue Sporthalle"]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Post_date_is_the_berlin_calendar_day()
|
||||
{
|
||||
var client = pocketBase.CreateClient();
|
||||
|
||||
var posts = await client.GetPostsAsync();
|
||||
|
||||
// The post is seeded as 2026-03-01 23:30Z, which is 2 March 00:30 in Berlin.
|
||||
// The date is the Berlin day the editor picked (2 March), not the raw UTC
|
||||
// day (1 March) -- the time zone is applied before the day is taken.
|
||||
var post = posts.Single(p => p.Title == "Neuer Vorstand");
|
||||
post.Date.ShouldBe(new DateOnly(2026, 3, 2));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Pages_exclude_non_public_records()
|
||||
{
|
||||
|
||||
@@ -283,10 +283,13 @@ public sealed class PocketBaseFixture : IAsyncLifetime
|
||||
order = 9, slug = "draft", embed = Array.Empty<string>(), @public = false,
|
||||
});
|
||||
|
||||
// Posts: newest first once sorted by -date.
|
||||
// Posts: newest first once sorted by -date. The first post is stored as
|
||||
// 2026-03-01 23:30Z on purpose: that is 2 March 00:30 in Berlin (winter,
|
||||
// UTC+1). An editor who picked 2 March must get 2 March back -- the date is
|
||||
// the Berlin day, so it must NOT be read as the raw UTC day (1 March).
|
||||
await CreateRecordAsync(http, "posts", new
|
||||
{
|
||||
date = "2026-03-01 00:00:00.000Z", title = "Neuer Vorstand",
|
||||
date = "2026-03-01 23:30:00.000Z", title = "Neuer Vorstand",
|
||||
body = "Text", slug = "new-board", @public = true,
|
||||
});
|
||||
await CreateRecordAsync(http, "posts", new
|
||||
|
||||
Reference in new issue
Block a user