From 5689ed809dd7b0feb1f1eabbb575f100a69c4523 Mon Sep 17 00:00:00 2001 From: Fabien O'Carroll Date: Sun, 4 Aug 2024 16:15:45 +0700 Subject: [PATCH] Fixed type for Article.published property Since the upgrade from 0.11.0-dev to 0.13.0-dev Fedify no longer accepts a datetime string for the `published` property and requires a Temporal.Instant --- package.json | 1 + src/handlers.ts | 3 ++- yarn.lock | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 54536225..43aabb20 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "dependencies": { "@fedify/fedify": "0.13.0-dev.318", "@hono/node-server": "1.11.1", + "@js-temporal/polyfill": "0.4.4", "@sentry/node": "8.13.0", "hono": "4.4.6", "knex": "3.1.0", diff --git a/src/handlers.ts b/src/handlers.ts index 457ccf70..7189de0b 100644 --- a/src/handlers.ts +++ b/src/handlers.ts @@ -18,6 +18,7 @@ import { ContextData, HonoContextVariables, fedify } from './app'; import { getSiteSettings } from './ghost'; import type { PersonData } from './user'; import { ACTOR_DEFAULT_HANDLE } from './constants'; +import { Temporal } from '@js-temporal/polyfill'; type StoredThing = { object: string | { @@ -55,7 +56,7 @@ async function postToArticle(ctx: RequestContext, post: Post) { name: post.title, content: post.html, image: toURL(post.feature_image), - published: post.published_at, + published: Temporal.Instant.from(post.published_at), preview: preview, url: toURL(post.url), }); diff --git a/yarn.lock b/yarn.lock index 99edf889..d0b21980 100644 --- a/yarn.lock +++ b/yarn.lock @@ -365,7 +365,7 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" -"@js-temporal/polyfill@^0.4.4": +"@js-temporal/polyfill@0.4.4", "@js-temporal/polyfill@^0.4.4": version "0.4.4" resolved "https://registry.yarnpkg.com/@js-temporal/polyfill/-/polyfill-0.4.4.tgz#4c26b4a1a68c19155808363f520204712cfc2558" integrity sha512-2X6bvghJ/JAoZO52lbgyAPFj8uCflhTo2g7nkFzEQdXd/D8rEeD4HtmTEpmtGCva260fcd66YNXBOYdnmHqSOg==