Skip to content

Add option to get date in local or specified time zone #11832

Description

@mono0x

Summary

Add option to get date in local or specified time zone.

Basic example

Add option to date type.

  query blogListQuery($skip: Int!, $limit: Int!) {
    ...
    allMarkdownRemark(...) {
      edges {
        node {
          ...
          frontmatter {
            date(formatString: "MMMM DD, YYYY", local: true) <-- use local time zone
            date(formatString: "MMMM DD, YYYY", tz: "Asia/Tokyo") <-- use specified time zone
          }
        }
      }
    }
  }

and/or add option to gatsby-config.js.

Motivation

Display date in an easy-to-understand way for main readers of the website.

Metadata

Metadata

Assignees

No one assigned

    Labels

    stale?Issue that may be closed soon due to the original author not responding any more.status: needs more infoNeeds triaging and reproducible examples or more information to be resolved

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions