Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Add hk region #4

Merged
merged 2 commits into from
Dec 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ You can omit `HH:mm:ss`, dad will help you auto suffix `00`.
## Regions
Current works regions for event:

`tw`, `ja` and `indo`

> The time zone of HK is same as TW
`tw`, `hk`, `ja` and `indo`

## API

Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ export { isToday } from './libs/isToday';
export { now } from './libs/now';

export const tw = (...args) => dad(...args).tw;
export const hk = (...args) => dad(...args).hk;
export const ja = (...args) => dad(...args).ja;
export const indo = (...args) => dad(...args).indo;
4 changes: 4 additions & 0 deletions src/libs/Dad.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ export default class Dad {
return getTime(new Date(`${suffix00(p.date)}+08:00`));
}

get hk() {
return this.tw;
}

get indo() {
const p = wm.get(this);

Expand Down
8 changes: 7 additions & 1 deletion src/libs/__tests__/Dad.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import dad, { tw, ja, indo } from '../../';
import dad, { tw, hk, ja, indo } from '../../';

describe('Dad functionality', () => {
it('return time in ms where time zone is +8:00', () => {
Expand All @@ -8,6 +8,12 @@ describe('Dad functionality', () => {

expect(tw('2017-12-13'))
.toBe(datetime);

expect(dad('2017-12-13').hk)
.toBe(datetime);

expect(hk('2017-12-13'))
.toBe(datetime);
});

it('return time in ms where time zone is +9:00', () => {
Expand Down