Skip to content

Commit 1576f20

Browse files
committed
update date types
1 parent 8584992 commit 1576f20

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

readme.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export default function App() {
7272

7373
| key | Type | Required | Description |
7474
| --- | --- | --- | ---- |
75-
| expiryTimestamp | number(timestamp) | YES | this will define for how long the timer will be running |
75+
| expiryTimestamp | Date object | YES | this will define for how long the timer will be running |
7676
| autoStart | boolean | No | flag to decide if timer should start automatically, by default it is set to `true` |
7777
| onExpire | Function | No | callback function to be executed once countdown timer is expired |
7878

@@ -89,7 +89,7 @@ export default function App() {
8989
| pause | function | function to be called to pause timer |
9090
| start | function | function if called after pause the timer will continue based on original expiryTimestamp |
9191
| resume | function | function if called after pause the timer will continue countdown from last paused state |
92-
| restart | function | function to restart timer with new expiryTimestamp, accept 2 arguments first is the new `expiryTimestamp` of type number(timestamp) and second is `autoStart` of type boolean to decide if it should automatically start after restart or not, default is `true` |
92+
| restart | function | function to restart timer with new expiryTimestamp, accept 2 arguments first is the new `expiryTimestamp` of type Date object and second is `autoStart` of type boolean to decide if it should automatically start after restart or not, default is `true` |
9393

9494

9595
---
@@ -144,7 +144,7 @@ export default function App() {
144144
| key | Type | Required | Description |
145145
| --- | --- | --- | ---- |
146146
| autoStart | boolean | No | if set to `true` stopwatch will auto start, by default it is set to `false` |
147-
| offsetTimestamp | number | No | this will define the initial stopwatch offset example: `const stopwatchOffset = new Date(); stopwatchOffset.setSeconds(stopwatchOffset.getSeconds() + 300);` this will result in a 5 minutes offset and stopwatch will start from 0:0:5:0 instead of 0:0:0:0 |
147+
| offsetTimestamp | Date object | No | this will define the initial stopwatch offset example: `const stopwatchOffset = new Date(); stopwatchOffset.setSeconds(stopwatchOffset.getSeconds() + 300);` this will result in a 5 minutes offset and stopwatch will start from 0:0:5:0 instead of 0:0:0:0 |
148148

149149
### Values
150150

src/index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function useTimer(settings: TimerSettings): TimerResult
2020

2121
interface StopwatchSettings {
2222
autoStart?: boolean;
23-
offsetTimestamp?: number;
23+
offsetTimestamp?: Date;
2424
}
2525

2626
interface StopwatchResult {
@@ -31,7 +31,7 @@ interface StopwatchResult {
3131
isRunning: boolean;
3232
start: () => void;
3333
pause: () => void;
34-
reset: (offsetTimestamp?: number, autoStart?: boolean) => void;
34+
reset: (offsetTimestamp?: Date, autoStart?: boolean) => void;
3535
}
3636

3737
export function useStopwatch(settings?: StopwatchSettings): StopwatchResult

0 commit comments

Comments
 (0)