From 7d1c09d17df183c5e1e2c5bb288ea8ac59ca4021 Mon Sep 17 00:00:00 2001 From: Piotr Kuczynski Date: Wed, 23 Mar 2022 22:26:23 +0100 Subject: [PATCH] docs: add jsdoc to the conversion functions --- src/date.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/date.ts b/src/date.ts index 0a75789a1ea..3929f98bb65 100644 --- a/src/date.ts +++ b/src/date.ts @@ -1,6 +1,11 @@ import type { Faker } from '.'; import type { DateEntryDefinition } from './definitions'; +/** + * Converts date passed as a string or Date to a Date object. If nothing passed, takes current date. + * + * @param date + */ function toDate(date?: string | Date): Date { if (date != null) { return new Date(date instanceof Date ? date : Date.parse(date)); @@ -9,6 +14,11 @@ function toDate(date?: string | Date): Date { return new Date(); } +/** + * Converts date passed as a string or Date to milliseconds. If nothing passed, takes current date. + * + * @param date + */ function toMilliseconds(date?: string | Date): number { if (date != null) { return date instanceof Date ? date.getTime() : Date.parse(date);