Relative timestamps (<t:…:R>) show wrong direction and size past ~4 weeks ("in 0 months" for a date 2 years ago)

Abierto
#1,425 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@MuhammadFaizan-prog ya está trabajando en esto.

Desde el 14/11/2026.

  • #1426 de @MuhammadFaizan-prog — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
javascript
Área
frontend

Línea de trabajo

Read timeAgo in packages/markups/src/elements/TimestampElement.js; the seconds-through-weeks branches are correct, so focus on the months and years branches that subtract only getMonth() / getFullYear() and lose the sign. Run the existing markup tests for TimestampElement with the four examples from the issue (36 days, 13 months, exactly 2 years, 66 days future) to confirm the failures before changing the elapsed-month calculation and rounding. Note that pull request #1426 is already open against this issue, so check its state before starting.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug
Description:

Relative timestamp markup (<t:UNIX:R>) is rendered by timeAgo in packages/markups/src/elements/TimestampElement.js. Seconds through weeks are derived from the elapsed time, but months and years are computed by subtracting only the calendar month and year numbers (getMonth() / getFullYear()). Once a timestamp is 4+ weeks away, the result ignores the year and gets the wrong sign across New Year:

  • 36 days ago (Dec 20 viewed on Jan 25) → "in 11 months"
  • 13 months ago → "1 month ago"
  • exactly 2 years ago (same calendar month) → "in 0 months"
  • 66 days in the future (Jan 20 viewed on Nov 15) → "10 months ago"
Steps to reproduce:
  1. During November 2026, send a message containing <t:1731672000:R> (Nov 15 2024).
  2. Send <t:1760529600:R> (Oct 15 2025) and <t:1768867200:R> (Jan 20 2027).
  3. Look at the rendered timestamps in EmbeddedChat.
Expected behavior:

"2 years ago", "1 year ago" and "in 2 months".

Actual behavior:

"in 0 months", "1 month ago" and "10 months ago".

Lenguaje dominante
JavaScript
Estrellas
170
Forks
397
Merge medio
12 d 14 h
PR fusionados (30 d)
6

Preparar el entorno

  • Sin Dockerfile ni archivo de Docker Compose
  • Tiene una plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de RocketChat/EmbeddedChat

Todos los issues de RocketChat/EmbeddedChat

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.