Skip to content

lastUpdated displays incorrect date #1166

@tmcw

Description

@tmcw

What version of starlight are you using?

0.13.1

What version of astro are you using?

3.6.3

What package manager are you using?

npm

What operating system are you using?

macOS

What browser are you using?

Firefox

Describe the Bug

I set lastUpdated in frontmatter to 2023-03-24:

CleanShot 2023-11-29 at 13 40 48@2x

And get March 23, 2024 as the output on the page:

CleanShot 2023-11-29 at 13 40 23@2x

But the <time> element includes the correct date.

The underlying component uses toLocaleDateString:

{lastUpdated.toLocaleDateString(lang, { dateStyle: 'medium' })}

Which uses the user-agent's timezone. So I'm at -5 offset, so it'll always show the wrong day on my computer.

Link to Minimal Reproducible Example

http://stackblitz.com/sorry-i-can-submit-a-pr-this-is-pretty-well-described-right

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions