Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

216
Views
How validate the dates?

I am comparing the dates wherein the next object created should not have the dates between the date present in my database objects. For that, I have created a validation

 $scope.shiftTypeValues.forEach(function (shift) {
                    if ((shift.endDate >= item.endDate || shift.endDate >= item.startDate)) {
                        window.alert("There is another shift between that date! Please select another shift");
                        found = true;
                    }
            });

Here, $scope.shiftTypeValues are the objects in my database and item are the current object for which I am checking the date. Right now I am comparing the end dates with the current item start date and end date but suppose I save the date as

    Start Date              End Date
1.) Feb 16,2022             Feb 19,2022
2.) Feb 20,2022             Feb 24,2022

Now, if I edit the first object end date and save the date as 18Feb,2022 which should save since there is no shift falling under that date but my condition is checking the end date so 24 feb > 19 feb and it is showing alert? So, what should I check in order to save my object?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!