Comparing version 1.0.43 to 1.0.44
@@ -210,3 +210,3 @@ export default jsUtils; | ||
export function isDateMidnight(date: any): boolean; | ||
export function setDateToMidnight(date: any): Date; | ||
export function setDateToMidnight(date: any): any; | ||
export function replaceAll(str: any, ...fromTo: any[]): any; | ||
@@ -213,0 +213,0 @@ export function cleanString(str: any): any; |
@@ -910,6 +910,12 @@ 'use strict'; | ||
function setDateToMidnight(date) { | ||
let dateToProcess = toDate(date); | ||
if (isDate(dateToProcess) === false) | ||
if (typeof date === 'string') | ||
return new Date(date.substring(0, 10)); | ||
let dateToProcess = date === undefined | ||
? new Date() | ||
: isDate(date) | ||
? date | ||
: new Date(date); | ||
if (isNaN(+dateToProcess)) | ||
return dateToProcess; | ||
if (isDateMidnight(dateToProcess) === true) | ||
if (isDateMidnight(dateToProcess)) | ||
return dateToProcess; | ||
@@ -916,0 +922,0 @@ return new Date(dateToProcess.toISOString().substring(0, 10)); |
@@ -210,3 +210,3 @@ export default jsUtils; | ||
export function isDateMidnight(date: any): boolean; | ||
export function setDateToMidnight(date: any): Date; | ||
export function setDateToMidnight(date: any): any; | ||
export function replaceAll(str: any, ...fromTo: any[]): any; | ||
@@ -213,0 +213,0 @@ export function cleanString(str: any): any; |
@@ -860,6 +860,12 @@ 'use strict'; | ||
function setDateToMidnight(date) { | ||
let dateToProcess = toDate(date); | ||
if (isDate(dateToProcess) === false) | ||
if (typeof date === 'string') | ||
return new Date(date.substring(0, 10)); | ||
let dateToProcess = date === undefined | ||
? new Date() | ||
: isDate(date) | ||
? date | ||
: new Date(date); | ||
if (isNaN(+dateToProcess)) | ||
return dateToProcess; | ||
if (isDateMidnight(dateToProcess) === true) | ||
if (isDateMidnight(dateToProcess)) | ||
return dateToProcess; | ||
@@ -866,0 +872,0 @@ return new Date(dateToProcess.toISOString().substring(0, 10)); |
{ | ||
"name": "js-awe", | ||
"version": "1.0.43", | ||
"version": "1.0.44", | ||
"homepage": "https://github.com/josuamanuel/js-awe", | ||
@@ -5,0 +5,0 @@ "author": "josuamanuel@hotmail.com", |
@@ -279,2 +279,3 @@ # js-awe | ||
* Simple async flows. Introducing another tool to learn may not be worth it. | ||
* Critical applications. It is not a contrasted solution with complex products using it in production. | ||
* You have the skills to do it better yourself: more flexible, readible and performance. | ||
@@ -281,0 +282,0 @@ * You are tired of new libraries, frameworks and abstractions. I get it! |
@@ -1056,9 +1056,16 @@ 'use strict' | ||
function setDateToMidnight(date) { | ||
let dateToProcess = toDate(date) | ||
if (isDate(dateToProcess) === false) return dateToProcess | ||
if(typeof date === 'string') return new Date(date.substring(0,10)) | ||
if (isDateMidnight(dateToProcess) === true) return dateToProcess | ||
let dateToProcess = date === undefined | ||
? new Date() | ||
: isDate(date) | ||
? date | ||
: new Date(date) | ||
return new Date(dateToProcess.toISOString().substring(0, 10)) | ||
if(isNaN(+dateToProcess)) return dateToProcess | ||
if(isDateMidnight(dateToProcess)) return dateToProcess | ||
return new Date(dateToProcess.toISOString().substring(0,10)) | ||
} | ||
@@ -1065,0 +1072,0 @@ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1137417
33120
363