Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

219
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda