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

100
Vistas
Creating a chrono-node customer parsing with a relative date

I'm using the https://github.com/wanasit/chrono package and was trying to expand the functionality to include an additional abbreviation. ('m' for minutes)

You'll notice m => minutes does not exist in the mapping array found here: https://github.com/wanasit/chrono/blob/1320d7c403cb4da23a8e06d82fcff5748f552936/src/locales/en/constants.ts#L136

I tried using a custom parser but I'm not quite understanding how it works:

const custom = chrono.casual.clone();
custom.parsers.push({
    pattern: () => {
        return /([\b|0-9]+)(m)\b/i;
    },
    extract: (context, match) => {
        return {
            minute: match[1]
        };
    }
});

If I type "in 15mins" (native parsing) it adds 15 minutes to "now" (relative) If I type "in 5m" using my customer parser, it sets the times minute to 5. (absolute)

How do I make my parser work with times relative to "now"

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