Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Title format is not configurable

Aperta
#272 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
42/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
javascript

Direzione di ricerca

Inizia da src/relative-time-element.ts, nel codice di formattazione del titolo collegato nell’issue, quindi esamina le opzioni di formattazione esistenti e i test correlati. Definisci e implementa il modo in cui la formattazione del titolo riutilizza le impostazioni di stile o accetta una regola indipendente, preservando la formattazione nel fuso orario locale del browser; il lavoro è completato quando il titolo supporta il formato localizzato richiesto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Hello, and thanks for this custom element!

I am starting to use <relative-time> in an app that supports multiple languages and users are in different countries. I started with the basics and just set the datetime attribute and inner text.

I noticed the automatic title always had short months. I tried to change it by setting formatStyle="long" and month="long" to no avail. Inspecting the source I found that titles use a fixed format:

https://github.com/github/relative-time-element/blob/7e40806f21684e46573e202527b9505e723d13e8/src/relative-time-element.ts#L116-L130

Thanks to the comment in the code above, I was able to temporarily solve for my use case by rendering the title from the server side, but that meant giving up showing the time in the timezone of the browser.

Would you consider re-using the style settings when formatting the title or provide a specific formatting rule for the title, independent from the inner text?

PS: Related, but less important, it would also be useful to add some text around the date, like title="Updated at {formatted-date-here}" (where the string "Updated at" is rendered in the correct locale on the server).

Thanks again!

Lingua principale
JavaScript
Stelle
4k
Fork
194
Merge medio
4g 10h
PR unite (30g)
5

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di github/relative-time-element

Tutte le issue di github/relative-time-element

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.