Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] countdown #47

Open
1000i100 opened this issue May 15, 2024 · 2 comments
Open

[feat] countdown #47

1000i100 opened this issue May 15, 2024 · 2 comments

Comments

@1000i100
Copy link

I would love to be able to generate countdown like this :
https://badgers.space/countdown/myLabel/2024-12-25 show a badge like this : [ myLabel | 9 months 3 days ]
https://badgers.space/countdown/myLabel/2024-12-25T12:00:00Z show a badge like this : [ myLabel | 9 months 3 days ] but if less than a month, it will be [ myLabel | 3 days 9 hours ] and less than a day [ myLabel | 6 hours 35 minutes ]
https://badgers.space/countdown/myLabel/2024-12-25/Md like [ myLabel | 9 months 3 days ] but will switch from [ myLabel | 1 day ] to [ myLabel | today ] then [ myLabel | ended ] without going down to hours or minute, because only M month and d day are given in pattern.
https://badgers.space/countdown/myLabel/2024-12-25/M will show : [ myLabel | 9 months ] then under a month : [ myLabel | this month ]
https://badgers.space/countdown/myLabel/2024-12-25/d will show : [ myLabel | 153 days ]
https://badgers.space/countdown/myLabel/2024-12-25T12:00:00/1Mdhm will show : [ myLabel | 9 months ] then under a month [ myLabel | 30 days ] down to minutes, but only on time unit at a time.
https://badgers.space/countdown/myLabel/2024-12-25T12:00:00/2Mdhm same than before but with to at a time (the default) : [ myLabel | 9 months 3 days ]
https://badgers.space/countdown/myLabel/2024-12-25T12:00:00/2Mdhm/fr same but in french : [ myLabel | 9 mois 3 jours ]

And why not with 2 dates for event :

https://badgers.space/event-countdown/myLabel/now/past/2024-12-25T12:00:00_2025-01-01T00:00:00 will show : [ myLabel | 9 months 3 days ] before the first date, then between the to dates : [ myLabel | now ] and after : [ myLabel | past ] and if you change past in the url by finished it will show : [ myLabel | finished ]

How about it ?

@SplittyDev
Copy link
Owner

SplittyDev commented May 15, 2024

Hey, that certainly sounds like a useful thing to add!

I'm a bit worried about how this would actually work in the real world, though.. Since Spacebadgers can only generate SVGs, the countdown will be frozen at the time of request, which in and of itself isn't a big issue, but platforms like GitHub do their own caching on top, which means that any countdown hosted on such platforms is most likely to be stale for quite some time, which limits the practical uses quite a bit..

Additionally, I think it would be hard to tell for users that it's even a countdown in the first place, because it isn't moving:

  • Countdown Example Badge 1
  • Countdown Example Badge 2
  • Countdown Example Badge 2

@1000i100
Copy link
Author

1000i100 commented May 15, 2024

Thinking with the cache limitation, i think it should be limited to date, without going down to hours and minutes.

But it still usefull in my mind.

If we really want to show the countdown part, svg can handle animation and scripting, but i don't know what part of the spec is used when svg are included with img tag.

if scripting is run from the svg, it can be static server-side and updated every second client-side

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants