Allow null and undefined as start parameter. (#34896)

According to the documentation, this indicates "now".
This commit is contained in:
Jeroen Akkerman 2019-04-23 22:43:46 +02:00 committed by Pranav Senthilnathan
parent 3d4299e6a9
commit 212ea87fbb
2 changed files with 5 additions and 2 deletions

View File

@ -6,6 +6,9 @@ let interval: number;
ts = <countdown.Timespan>countdown(new Date());
ts = <countdown.Timespan>countdown(150);
ts = <countdown.Timespan>countdown(undefined, Date.now() + 60000);
ts = <countdown.Timespan>countdown(Date.now() - 60000, null);
interval = <number>countdown(new Date(),
function (ts: countdown.Timespan) {
document.getElementById('pageTimer').innerHTML = ts.toHTML('strong');

View File

@ -1,11 +1,11 @@
// Type definitions for countdown.js
// Project: http://countdownjs.org/
// Definitions by: Gabriel Juchault <https://github.com/gjuchault>
// Definitions by: Gabriel Juchault <https://github.com/gjuchault>, Ionaru <https://github.com/Ionaru>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace countdown {
type DateFunction = (timespan: Timespan) => void;
type DateTime = number | Date | DateFunction;
type DateTime = number | Date | DateFunction | null | undefined;
interface Timespan {
start?: Date;