Skip to content

Commit

Permalink
✨ support locale
Browse files Browse the repository at this point in the history
  • Loading branch information
maxam2017 committed Apr 15, 2020
1 parent 96a57bf commit 910c536
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/schedule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GIST_ID: 9842e074b8ee46aef76fd0d493bae0ed
LOCALE: zh-TW
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
### Project setup

1. Fork this repo
2. Edit the [environment variable](https://github.com/maxam2017/productive-box/blob/master/.github/workflows/schedule.yml#L16-L17) in `.github/workflows/schedule.yml`:
2. Edit the [environment variable](https://github.com/maxam2017/productive-box/blob/master/.github/workflows/schedule.yml#L17-L18) in `.github/workflows/schedule.yml`:

- **GIST_ID:** The ID portion from your gist url: `https://gist.github.com/maxam2017/`**`9842e074b8ee46aef76fd0d493bae0ed`**.
- **LOCALE:** The locale of your country, eg. `zh-TW` for Taiwan, `en-US` for America, etc.

3. Go to the repo **Settings > Secrets**
4. Add the following environment variables:
- **GH_TOKEN:** The GitHub token generated above.

2 changes: 1 addition & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ interface IRepo {
committedTimeResponseMap.forEach(committedTimeResponse => {
committedTimeResponse?.data?.repository?.ref?.target?.history?.edges.forEach(edge => {
const committedDate = edge?.node?.committedDate;
const timeString = new Date(committedDate).toLocaleTimeString([ 'zh-TW' ], { hour12: false });
const timeString = new Date(committedDate).toLocaleTimeString([ process.env.LOCALE, 'en-US' ], { hour12: false });
const hour = +(timeString.split(':')[0]);

/**
Expand Down

0 comments on commit 910c536

Please sign in to comment.