Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

check if a date is more than 18 years javascript

function isOverEighteen(year, month, day) {
  var now = parseInt(new Date().toISOString().slice(0, 10).replace(/-/g, ''));
  var dob = year * 10000 + month * 100 + day * 1; // Coerces strings to integers

  return now - dob > 180000;
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: js reverse int in descending order 
Javascript :: empty input field on click 
Javascript :: js for loops 
Javascript :: async await class component react 
Javascript :: set file upllaod via javascript to html input 
Javascript :: round innerhtml up javascript 
Javascript :: first letter uppercase in jquery 
Javascript :: how to choose a random name from a list in javascript 
Javascript :: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 
Javascript :: javascript hello 
Javascript :: How to test useEffect in react testing library 
Javascript :: jquery get cursor position 
Javascript :: change array of object to object without index value 
Javascript :: TypeError: Class constructor Model cannot be invoked without 
Javascript :: create dynamic element in javascript 
Javascript :: angular 6 key value pair getvalue example 
Javascript :: ubuntu internet speed booster 
Javascript :: reload page after form submit javascript 
Javascript :: sequelize array of strings 
Javascript :: sort method in js 
Javascript :: javascript string to number 
Javascript :: lodash sort json 
Javascript :: javascript newline to brake 
Javascript :: javascript particles js not working 
Javascript :: discord.js timeout 
Javascript :: js password check 
Javascript :: jsdoc for express routes 
Javascript :: how to find the sum of array using JavaScript 
Javascript :: js months ago 
Javascript :: angular timeout function 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =