gatsby-plugin-buildtime-timezone
v1.0.3
Published
Gatsby plugin to display buildtime in local timezone
Downloads
426
Maintainers
Readme
gatsby-plugin-buildtime-timezone
Similar to the build in buildTime
query, but provides the option to set the timezone for the build.
It uses Moment Timezone for the timezone conversion.
Install
npm install --save gatsby-plugin-buildtime-timezone
How to use
// In your gatsby-config.js
plugins: [
{
resolve: 'gatsby-plugin-buildtime-timezone',
options: {
tz: 'Pacific/Auckland',
format: 'ddd, DD MMM YYYY hh:mm A',
},
},
];
Parameters
tz
accepts Moment Timezone methodmoment.tz()
params.Most common use would be passing the timezone name as a sting like this.
tz: 'Europe/Zagreb'
tz: 'GMT'
format
accepts Moment.js methodmoment().format()
params.format: 'dddd, MMMM Do YYYY, h:mm:ss a' // "Sunday, February 14th 2010, 3:25:50 pm"
format: 'ddd, DD MMM YYYY hh:mm A zz' // "Thu, 19 Apr 2018 08:39 AM Thu, 19 Apr 2018 08:39 AM NZ"
Timezone names
Here is a list of all the moment timezone names that moment.tz.names()
will return as of version 0.5.15
. Any of these can be used to pass the tz
option.
How to query
A sample GraphQL query:
{
site {
buildTimeZone
}
}