UNPKG

1.37 kBTypeScriptView Raw
1import { Duration } from './duration';
2/**
3 * Represents a date of expiration.
4 *
5 * The amount can be specified either as a Date object, timestamp, Duration or string.
6 */
7export declare class Expiration {
8 /**
9 * Expire at the specified date
10 * @param d date to expire at
11 */
12 static atDate(d: Date): Expiration;
13 /**
14 * Expire at the specified timestamp
15 * @param t timestamp in unix milliseconds
16 */
17 static atTimestamp(t: number): Expiration;
18 /**
19 * Expire once the specified duration has passed since deployment time
20 * @param t the duration to wait before expiring
21 */
22 static after(t: Duration): Expiration;
23 /**
24 * Expire at specified date, represented as a string
25 *
26 * @param s the string that represents date to expire at
27 */
28 static fromString(s: string): Expiration;
29 /**
30 * Expiration value as a Date object
31 */
32 readonly date: Date;
33 private constructor();
34 /**
35 * Exipration Value in a formatted Unix Epoch Time in seconds
36 */
37 toEpoch(): number;
38 /**
39 * Check if Exipiration expires before input
40 * @param t the duration to check against
41 */
42 isBefore(t: Duration): boolean;
43 /**
44 * Check if Exipiration expires after input
45 * @param t the duration to check against
46 */
47 isAfter(t: Duration): boolean;
48}