Skip to content

Commit 1d9207c

Browse files
committed
fix: use toDatetimeString for greater safety
1 parent ca73c2e commit 1d9207c

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

modules/standard-site-sync.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { PasswordSession } from '@atproto/lex-password-session'
99
import {
1010
Client,
1111
isAtIdentifierString,
12+
toDatetimeString,
1213
XrpcResponseError,
1314
type AtIdentifierString,
1415
} from '@atproto/lex'
@@ -175,7 +176,7 @@ function buildATProtoDocument(siteUrl: string, data: BlogPostDocument) {
175176
description: data.description ?? data.excerpt,
176177
tags: data.tags,
177178
// Publish on the record with the current date
178-
publishedAt: new Date().toISOString(),
179+
publishedAt: toDatetimeString(new Date()),
179180
})
180181
}
181182

server/api/social/like.post.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as v from 'valibot'
2-
import { Client } from '@atproto/lex'
2+
import { Client, toDatetimeString } from '@atproto/lex'
33
import * as dev from '#shared/types/lexicons/dev'
44
import type { UriString } from '@atproto/lex'
55
import { LIKES_SCOPE } from '#shared/utils/constants'
@@ -30,7 +30,7 @@ export default eventHandlerWithOAuthSession(async (event, oAuthSession) => {
3030
const client = new Client(oAuthSession)
3131

3232
const like = dev.npmx.feed.like.$build({
33-
createdAt: new Date().toISOString(),
33+
createdAt: toDatetimeString(new Date()),
3434
subjectRef: subjectRef as UriString,
3535
})
3636

0 commit comments

Comments
 (0)