nolanlawson/pinafore

Poles always show as ending never

TheQuinbox opened this issue · 4 comments

No matter if you're voting on or creating a pole, the ending date always shows as "Never", even after the pole has ended and is in your notifications.

graue commented

Yes, I'm also seeing polls all say they end never. Hometown v1.0.7+3.5.5 server if it matters.

I'm also on Hometown, if it matters.

This also happens to me with a Mastodon v4.0.2 server.

I'd say this is because Pinafore expects the server to return the expires_at as a number:

expiresAt: ({ poll }) => poll.expires_at,
// Misskey can have polls that never end. These give expiresAt as null
expiresAtTS: ({ expiresAt }) => typeof expiresAt === 'number' ? new Date(expiresAt).getTime() : null,

whereas the API says it's an ISO-formatted string: https://docs.joinmastodon.org/entities/Poll/#expires_at

Maybe just replace that typeof expiresAt === 'number' test to expiresAt != null?

Thanks yeah, looks like Mastodon v4 uses strings now.