Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

66
Vistas
check if a date is between two dates in different years

I'm gonna use MomentJs or Dayjs to see if for instance Apr/03 is between Nov/01 and May/01.

When we try isBetween it doesn't work as in a year Nov/01 is not before Apr/03 but if you look at it as a two-year scop it should return true for moment('Apr/03').isBetween('Nov/01', 'May/01')

P.S. I cannot enter a year, for instance Apr/02/2021 is not an option.

Ok then, exports, what do you recommend?

7 months ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I'm going to assume the earlier bound will always be in the first year and the later bound will always be in the second year, otherwise it is pretty much impossible.

moment('Apr/03').isAfter('Nov/01') || moment('Apr/03').isBefore('May/01')

7 months ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos