From f0a7175e8322c184264e0fb5835350c5622372a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Chrastina?= Date: Wed, 11 Jan 2023 16:15:50 +0100 Subject: [PATCH 1/2] add example showcasing timezone --- package-lock.json | 4 ++-- package.json | 1 + site/src/pages/articles.js | 11 ++++++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 74f3a0bc..12e9bfe4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32518,7 +32518,7 @@ }, "packages/gatsby-components": { "name": "@kontent-ai/gatsby-components", - "version": "9.0.2", + "version": "9.1.0", "license": "MIT", "dependencies": { "html-react-parser": "^3.0.4" @@ -32572,7 +32572,7 @@ }, "packages/gatsby-source": { "name": "@kontent-ai/gatsby-source", - "version": "9.0.2", + "version": "9.1.0", "license": "MIT", "dependencies": { "@kontent-ai/webhook-helper": "^2.0.1", diff --git a/package.json b/package.json index b9734358..b411755f 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "lint": "npm run lint --workspaces", "lint:fix": "run lint --workspaces -- --fix", "test": "npm run test --workspaces", + "clean:site": "npm run clean --workspace=@kontent-ai/gatsby-starter-kontent-hello-world", "build": "npm run build --workspaces", "build:source": "npm run build --workspace=@kontent-ai/gatsby-source", "build:components": "npm run build --workspace=@kontent-ai/gatsby-components ", diff --git a/site/src/pages/articles.js b/site/src/pages/articles.js index e0a9e4af..4dc638a7 100644 --- a/site/src/pages/articles.js +++ b/site/src/pages/articles.js @@ -14,11 +14,12 @@ const Articles = (props) => { )); return (
+
({variant.preferred_language}{variant.preferred_language !== variant.system.language ? ` -> ${variant.system.language}` : null})
+
Date: {variant.elements.date.value}{variant.elements.date.display_timezone && ` (${variant.elements.date.display_timezone})`}
- ({variant.preferred_language}{variant.preferred_language !== variant.system.language ? ` -> ${variant.system.language}` : null}) - Title: {variant.elements.title.value} + Title: {variant.elements.title.value}
-
Description: {variant.elements.description.value}
+
Description: {variant.elements.description.value}
{tags}
) @@ -60,6 +61,10 @@ export const query = graphql` title { value } + date { + value + display_timezone + } description { value } From 5daae6dd21c46d4fb73f052e33ea97adf7a62690 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Chrastina?= Date: Wed, 11 Jan 2023 16:19:11 +0100 Subject: [PATCH 2/2] adjust readme to contain timezone information --- site/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/site/README.md b/site/README.md index 9d3cab0b..32e27150 100644 --- a/site/README.md +++ b/site/README.md @@ -69,6 +69,10 @@ The best solution is to use [Kontent.ai Image transformation API](https://docs.k > See the ["author page"](./src/pages/author.js) as a showcase, how you could render the profile photo different way ([live preview](https://kontent-gatsby-packages.netlify.app/author)). +## Timezone + +If you want to see how to fetch the timezone information, see the See the ["articles page"](./src/pages/articles.js). + --- Based on [official Gatsby Hello World starter](https://github.com/gatsbyjs/gatsby-starter-hello-world).