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

163
Visualizações
checking the ISO data format is not working

I'm trying to check if the 'date-time' string is ISO formatted and I get the following output:

isIsoDate the date string is not ISO format! :  2022-04-21T09:40:01.000Z
isIsoDate converted-back date :  2022-04-21T09:40:01.000Z
isIsoDate time stamp number :  1650534001000
isIsoDate string builded back :  Thu Apr 21 2022 11:40:01 GMT+0200 (Ora legale dell’Europa centrale) 

this is my code:

export function isIsoDate(dateString) {
    
        var dateParsedNum = Date.parse(dateString);
        var dateBackToString = new Date(dateParsedNum);
        var stringBuilded = "";
    
    
        stringBuilded = dateBackToString.toString()
    
    
        if ((dateBackToString.toString()) == dateString) {
            return true;
            
        } else {
           console.debug("isIsoDate() the date string is not ISO format! : ", dateString);
           console.debug("isIsoDate() converted-back date : ", dateBackToString);
           console.debug("isIsoDate() time stamp number : ", dateParsedNum);
           console.debug("isIsoDate() string builded back : ", stringBuilded);
           // throw new BadRequestException('Validation failed');
        }
    
        return(false)
    }
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

I'm not sure if it can be done with JavaScript's Date utilities. As Salman said in the comments, you can have .toISOString() instead, but this method converts everything into UTC, whereas the ISO specification is more flexible than that.

I recommend this StackOverFlow answer that uses RegEx to validate ISO strings.

about 4 years ago · Juan Pablo Isaza Relatório

0

did you check the setting? there is several solutions in the site

about 4 years ago · Juan Pablo Isaza Relatório
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