Skip to content

Commit d110548

Browse files
leoylilonglho
authored andcommitted
feat: allow formatDate and formatTime to take string type (#1369)
JS have implicitly type conversion, 2019-07-13 can be read correctly. This makes it easy to use when date is read from a JSON object.
1 parent 65eef98 commit d110548

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ export type MessageFormatPrimitiveValue =
5959
| undefined;
6060

6161
export interface IntlFormatters {
62-
formatDate(value: number | Date, opts: FormatDateOptions): string;
63-
formatTime(value: number | Date, opts: FormatDateOptions): string;
62+
formatDate(value: string | number | Date, opts: FormatDateOptions): string;
63+
formatTime(value: string | number | Date, opts: FormatDateOptions): string;
6464
formatRelativeTime(
6565
value: number,
6666
unit?: FormattableUnit,

0 commit comments

Comments
 (0)