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

234
Vistas
Trying to get moment to convert month to Number but i get incorrect value

Need help figuring out why moment is returning incorrect value. This is the problem i am facing. At anytime i can get either a french or english value. For example if cMon = "août 2022" when this code runs cNMon returns 2 instead of 8

i tried passing locale but the issue is it needs to be able to accept either french or english and display the correct value.

Line of typescript code

import moment from 'moment';


private static async getCurrent(actor: Actor): Promise<{ Mon: string, Year: number, MonStr: string, NMon: number}> {
        let cMon = await actor.requestTo(GetElementText.for(cmon));
        let Year = Number(currMonthText.split(" ")[1]);
        let MonStr = currMonthText.split(" ")[0];
        let cNMon: number  = Number(moment().month(currMonthStr.trim()).format("M"));

   

        return { cMon, Year, MonStr, NMon }
    }
about 4 years ago · Juan Pablo Isaza
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