We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7a8c5dc commit 7d1c09dCopy full SHA for 7d1c09d
1 file changed
src/date.ts
@@ -1,6 +1,11 @@
1
import type { Faker } from '.';
2
import type { DateEntryDefinition } from './definitions';
3
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
+ */
9
function toDate(date?: string | Date): Date {
10
if (date != null) {
11
return new Date(date instanceof Date ? date : Date.parse(date));
@@ -9,6 +14,11 @@ function toDate(date?: string | Date): Date {
14
return new Date();
15
}
16
17
18
+ * Converts date passed as a string or Date to milliseconds. If nothing passed, takes current date.
19
20
21
12
22
function toMilliseconds(date?: string | Date): number {
13
23
24
return date instanceof Date ? date.getTime() : Date.parse(date);
0 commit comments