-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to get date in local or specified time zone #11832
Comments
Why do you want to do this inside the query and not inside the page or component itself? |
Thank you for your comment. I didn't know I can get raw string of the
I could display date in local time zone using following query and page.
import moment from 'moment'
<small>{moment(node.frontmatter.date).local().format(`MMMM DD, YYYY`)}</small> Therefore, I think that applying time zone in query is not absolutely necessary. However, if Gatsby supports |
Gatsby converts stored date to UTC cases the reported dates shifts. This patch is to shows stored date as-is and format date in UI side which is known as a workaround. Fixes: aws-amplify#17 Refs: gatsbyjs/gatsby#11832 (comment)
Re-opening this as it's a valid use case as if you're displaying dates e.g. for an event, you often know what time zone you want to display and it'd be nice to generate that at build-time vs having to load a library for it. Intl is close to being widely usable ~90% but not quite there https://caniuse.com/?search=intl |
Summary
Add option to get
date
in local or specified time zone.Basic example
Add option to
date
type.and/or add option to
gatsby-config.js
.Motivation
Display date in an easy-to-understand way for main readers of the website.
The text was updated successfully, but these errors were encountered: