github / github/relative-time-element

Force format to absolute iso8601

Abierto
#293 2 comentarios 5 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
JavaScript
Estrellas
4k
Forks
192
Merge medio
1 d 10 h
PR fusionados (30 d)
5

Descripción

This code runs on github.com and displays timestamps in relative formatting...
but I really NEVER want to see timestamps in relative form.

I'd so much rather that 'last week' show up as '2024-09-26 19:05:24' or anything similar to iso8601.

Perhaps this just needs a new format string (for non-duration timestamps) of 'iso8601' ?

I can convince github pages to reveal an absolute timestamp with the following snippet pasted into the console.
```
document.querySelectorAll('relative-time[datetime]')
.forEach( item => {
item.setAttribute('format','datetime')
item.setAttribute('formatStyle','long')
item.setAttribute('precision','minute')
});
```
... but I get 'Thu, Sep 26' which is way too short.

I can use this snippet to update the title to show what I want but I still have to hover
```
document.querySelectorAll('relative-time[datetime]')
.forEach( item =>
item.setAttribute(
"title",
new Date(
Math.round(
Date.parse( item.getAttribute("datetime") )
/ 60000 ) * 60000
)
.toISOString()
.replace(/T/," ")
.replace(/[.].*/,"")
+" UTC"
)
)
```

perhaps I should be looking to convince Intl.DateTimeFormat with a Locale that emits iso8601 instead?

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza revisando las opciones de formato de tiempo relativo y el comportamiento de Intl.DateTimeFormat mencionado en el issue. Se considera completado cuando los usuarios pueden solicitar una marca de tiempo absoluta con estilo ISO 8601 en lugar de texto relativo, y la salida es considerablemente más larga que el formato actual 'Thu, Sep 26'.

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

Evaluación

Stack tecnológico
javascript
Área
frontend
Tipo de issue
Nueva funcionalidad
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.