Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Sascha Manns
Added: Apr 17, 2019 2:33 PM
Modified: Apr 23, 2019 6:51 AM
Views: 27
Tags: no tags
  1. function hasError() {
  2.     function toDate(datestr) {
  3.         var parts = datestr.split(".")
  4.         return new Date(parts[2], parts[1] -1, parts[0]).toLocaleString('de-DE', {timeZone: 'Europe/Berlin'})
  5.     }
  6.  
  7.     var comparestart = toDate("02.11.2018");
  8.     var compareende = toDate("20.10.2018");
  9.  
  10.     if(comparestart >= compareende) {
  11.         console.log(true);
  12.     } else {
  13.         console.log(false);
  14.     }
  15. }