Tokyo-Metro-Gov / covid19

東京都 新型コロナウイルス感染症対策サイト / Tokyo COVID-19 Task Force website
https://stopcovid19.metro.tokyo.lg.jp/
MIT License
6.26k stars 1.97k forks source link

Enhancement: Indicate the timezone next to the time the page was last updated #1207

Closed francisfuzz closed 4 years ago

francisfuzz commented 4 years ago

改善詳細 / Details of Improvement

It would be great to indicate the timezone next to the time the page was last updated. ⌚️

スクリーンショット / Screenshot

what-is-the-timezone-here

期待する見せ方・挙動 / Expected behavior

Indicating a timezone will help people all over the world to know exactly when in time the page was last updated. 🗺 👍

動作環境・ブラウザ / Environment

All environments are affected.

Research 🔍

We render the formatted date and time in the page header component:

https://github.com/tokyo-metropolitan-gov/covid19/blob/32beeada2bfa587ed551c4b860570737cab197e7/components/PageHeader.vue#L11

The formatted date is defined in the script:

https://github.com/tokyo-metropolitan-gov/covid19/blob/32beeada2bfa587ed551c4b860570737cab197e7/components/PageHeader.vue#L70

The convertDatetimeToISO8601Format() method is imported from the utils/formatDate module:

https://github.com/tokyo-metropolitan-gov/covid19/blob/32beeada2bfa587ed551c4b860570737cab197e7/utils/formatDate.ts#L3-L5

This relies on the iamkun/dayjs library and I can look into which timezone it sets by default (my guess is UTC, but I'll look into that just to be sure 😉 ).


👋 Note for maintainers: I'm interested in getting assigned to this!

francisfuzz commented 4 years ago

This relies on the iamkun/dayjs library and I can look into which timezone it sets by default (my guess is UTC, but I'll look into that just to be sure 😉 ).

Checked Day.js documentation and found the UTC section:

By default, Day.js parses and displays in local time.

If you want to parse or display a date-time in UTC, you can use dayjs.utc() instead of dayjs().

I think UTC is an appropriate timezone to use instead of whatever the default is. 👍

halsk commented 4 years ago

@francisfuzz Thank you for letting us know. If you can fix it by yourself and make a Pull Request, it's very welcome! How do you think?

francisfuzz commented 4 years ago

Thank you for letting us know. If you can fix it by yourself and make a Pull Request, it's very welcome! How do you think?

@halsk - I will investigate and open a pull request -- thank you! 😸

francisfuzz commented 4 years ago

@halsk - I'm sorry I lost track of this! 😞 Since data/data.json is automatically updated, my guess is that the timezone is automatically set to whatever the machine's configuration is set to. Is that a correct assumption?

If so, the timezone may not be UTC after all. Looking at https://github.com/tokyo-metropolitan-gov/covid19/commit/a19251281bce5893af5ca466ca547664aad89780, the patch shows the following author information:

From: data builder bot@code4japan.org

I'm wondering if that code is open source? If not, I'm wondering if you can ask the maintainer of the bot what timezone the machine that executes this data job is? I think that would help us move this over the line 😸

kaizumaki commented 4 years ago

@francisfuzz Thank you for your reply! I'm a member of the maintainer of this repository.

From: data builder bot@code4japan.org

This account is used by the private repository we maintain. So we can configure this bot. How should I do it?

ghost commented 4 years ago

@francisfuzz As you know, now the last updated date of the page header is taken from the lastUpdate value in the data.json file. The time zone of the lastUpdate value in the data.json file is Japan Standard Time.

The data.json file is put in the repository by the data loader managed by the Tokyo Metropolitan Government. I think it's difficult to change that data loader.

francisfuzz commented 4 years ago

This account is used by the private repository we maintain. The time zone of the lastUpdate value in the data.json file is Japan Standard Time.

Hello, @kaizumaki & @tokyo-citizen! Thank you both for sharing that additional context. I actually did not know that the bot is used in a private repository and confirming the way lastUpdate is determined.

@kaizumaki - I don't think we need to change anything for this bot. We are okay there. 👍

@tokyo-citizen - It's good to know that the Tokyo Metropolitan Government has control over the data loader and that it's not easy to change. Since the time zone is explicitly known as Japan Standard Time, I can go ahead and open a PR that updates all instances where lastUpdate is called to include Japan Standard Time. 🇯🇵 ⌚

I think it's helpful to document this particular time zone detail. Is the FOR_DEVELOPERS.md file the best place to write that down? Or, do you prefer a different document? :octocat: 💭

ghost commented 4 years ago

@francisfuzz

I think it's helpful to document this particular time zone detail. Is the FOR_DEVELOPERS.md file the best place to write that down? Or, do you prefer a different document?

Unfortunately, so far, may the source be with you! 💪

francisfuzz commented 4 years ago

I opened ~https://github.com/tokyo-metropolitan-gov/covid19/pull/5108~ https://github.com/tokyo-metropolitan-gov/covid19/pull/5109 to resolve this! :octocat: