danielroe / nuxt-time

⏰ SSR-safe time element for Nuxt 3
MIT License
349 stars 15 forks source link

Have a prop to expose the actual datetime as a title attribute when using relative time #311

Open jawnothin opened 14 hours ago

jawnothin commented 14 hours ago

🆒 Your use case

When I use relative time, I'd like to be able to see the original time as well respecting the format that the non-relative time would have produced.

🆕 The solution you'd like

Add another prop to the component that would add a title attribute to the rendered component similar to this:

<NuxtTime :datetime="new Date()" relative title />

Which would an output like this

<time data-relative="true" datetime="2024-11-21T22:24:51.432Z"  title="11/21/2024">15 hours ago</time>

🔍 Alternatives you've considered

I currently just manually setting the title tag, with the appropriate value.

ℹī¸ Additional info

No response