@@ -22,13 +22,6 @@ function toBase64(str) {
22
22
return Buffer . from ( str ) . toString ( 'base64' ) ;
23
23
}
24
24
25
- function formatDate ( date , dateFormat ) {
26
- if ( dateFormat == null ) {
27
- return date ;
28
- }
29
- return moment ( date ) . format ( dateFormat ) ;
30
- }
31
-
32
25
const fakeFunctions = {
33
26
// Address section
34
27
zipCode : ( ) => faker . address . zipCode ( ) ,
@@ -86,19 +79,19 @@ const fakeFunctions = {
86
79
date : {
87
80
args : [ 'dateFormat' , 'dateFrom' , 'dateTo' ] ,
88
81
func : ( dateFormat , dateFrom , dateTo ) =>
89
- formatDate ( faker . date . between ( dateFrom , dateTo ) , dateFormat ) ,
82
+ moment ( faker . date . between ( dateFrom , dateTo ) ) . format ( dateFormat ) . toString ( ) ,
90
83
} ,
91
84
pastDate : {
92
85
args : [ 'dateFormat' ] ,
93
- func : ( dateFormat ) => formatDate ( faker . date . past ( ) , dateFormat ) ,
86
+ func : ( dateFormat ) => moment ( faker . date . past ( ) ) . format ( dateFormat ) ,
94
87
} ,
95
88
futureDate : {
96
89
args : [ 'dateFormat' ] ,
97
- func : ( dateFormat ) => formatDate ( faker . date . future ( ) , dateFormat ) ,
90
+ func : ( dateFormat ) => moment ( faker . date . future ( ) ) . format ( dateFormat ) ,
98
91
} ,
99
92
recentDate : {
100
93
args : [ 'dateFormat' ] ,
101
- func : ( dateFormat ) => formatDate ( faker . date . recent ( ) , dateFormat ) ,
94
+ func : ( dateFormat ) => moment ( faker . date . recent ( ) ) . format ( dateFormat ) ,
102
95
} ,
103
96
104
97
// Finance section
0 commit comments