Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

161
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

0

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

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda