react-hook-core 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +3 -1
- package/package.json +1 -1
- package/src/index.ts +4 -1
package/lib/index.js
CHANGED
|
@@ -123,7 +123,9 @@ function dateToString(date) {
|
|
|
123
123
|
exports.dateToString = dateToString;
|
|
124
124
|
;
|
|
125
125
|
function datetimeToString(date) {
|
|
126
|
-
if (date ===
|
|
126
|
+
if (!date || date === '') {
|
|
127
|
+
return undefined;
|
|
128
|
+
}
|
|
127
129
|
var d2 = typeof date !== "string" ? date : new Date(date);
|
|
128
130
|
var year = d2.getFullYear();
|
|
129
131
|
var month = String(d2.getMonth() + 1).padStart(2, "0");
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -172,7 +172,10 @@ export function dateToString(date: Date | string): string {
|
|
|
172
172
|
const day = String(d2.getDate()).padStart(2, "0");
|
|
173
173
|
return `${year}-${month}-${day}`;
|
|
174
174
|
};
|
|
175
|
-
export function datetimeToString(date
|
|
175
|
+
export function datetimeToString(date?: Date | string): string|undefined {
|
|
176
|
+
if (!date || date === '') {
|
|
177
|
+
return undefined;
|
|
178
|
+
}
|
|
176
179
|
const d2 = typeof date !== "string" ? date : new Date(date);
|
|
177
180
|
const year = d2.getFullYear();
|
|
178
181
|
const month = String(d2.getMonth() + 1).padStart(2, "0");
|