Skip to content

Commit 7d1c09d

Browse files
committed
docs: add jsdoc to the conversion functions
1 parent 7a8c5dc commit 7d1c09d

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/date.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import type { Faker } from '.';
22
import type { DateEntryDefinition } from './definitions';
33

4+
/**
5+
* Converts date passed as a string or Date to a Date object. If nothing passed, takes current date.
6+
*
7+
* @param date
8+
*/
49
function toDate(date?: string | Date): Date {
510
if (date != null) {
611
return new Date(date instanceof Date ? date : Date.parse(date));
@@ -9,6 +14,11 @@ function toDate(date?: string | Date): Date {
914
return new Date();
1015
}
1116

17+
/**
18+
* Converts date passed as a string or Date to milliseconds. If nothing passed, takes current date.
19+
*
20+
* @param date
21+
*/
1222
function toMilliseconds(date?: string | Date): number {
1323
if (date != null) {
1424
return date instanceof Date ? date.getTime() : Date.parse(date);

0 commit comments

Comments
 (0)