Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Javascript is empty function
// Current value is empty
this.isEmpty = function(value){
return value == null // NULL value
|| value == undefined // undefined
|| value == 'undefined' // undefined
|| value.length == 0 // Array is empty
|| value == '00000000-0000-0000-0000-000000000000' // Guid empty
|| ((value instanceof Date && !isNaN(value.valueOf())) // Validate DateTime value and check min-max value
&& ((value <= new Date(1753, 01, 01)) // SQL DateTime minimum value
|| (value >= new Date(9999, 12, 31, 23, 59, 59, 999))) // SQL DateTime maximum value
);
}
@richardkundl
Copy link
Author

richardkundl commented Jan 28, 2015

add SQL DateTime check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment