Skip to content

Wrong param and return types on time.recent #533

@xDivisionByZerox

Description

@xDivisionByZerox

We will not add a default case.
Instead we adjust the method signature to allow for unkown string params and return dates in v6.0.

recent(format: LiteralUnion<'abbr' | 'wide' | 'unix' | 'date'> = 'unix'): string | number | Date { ... }

Previous description

The switch statement in time.recent is missing the a default switch case.

faker/src/time.ts

Lines 21 to 31 in 1058e17

switch (format) {
case 'abbr':
date = date.toLocaleTimeString();
break;
case 'wide':
date = date.toTimeString();
break;
case 'unix':
// TODO @Shinigami92 2022-01-10: add default case
date = date.getTime();
break;

FFR: Documented by @Shinigami92

Metadata

Metadata

Assignees

Labels

c: bugSomething isn't workingc: featureRequest for new featuregood first issueGood for newcomers

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions