Jump to content

[HTML & JS] Incomming event(s) in html

Go to solution Solved by minibois,

You can make a list of special dates (probably a 2D array, with a date and special message. e.g. save January first (of every year) and a special message/string that says "happy new year!" for example) and check the current date against this array.

If you just want something quick and dirty, this will work. But the disadvantages are plenty:

- This will be calculated every time the user loads the webpage

- If they have the wrong date setup, it will do weird stuff

 

You might want to calculate that sort of stuff server-side, once a day for example (although you might want to sync that up to the user's timezone).

This should get you somewhat started on the simple implementation:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date

You can make a list of special dates (probably a 2D array, with a date and special message. e.g. save January first (of every year) and a special message/string that says "happy new year!" for example) and check the current date against this array.

If you just want something quick and dirty, this will work. But the disadvantages are plenty:

- This will be calculated every time the user loads the webpage

- If they have the wrong date setup, it will do weird stuff

 

You might want to calculate that sort of stuff server-side, once a day for example (although you might want to sync that up to the user's timezone).

This should get you somewhat started on the simple implementation:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date

"We're all in this together, might as well be friends" Tom, Toonami.

 

mini eLiXiVy: my open source 65% mechanical PCB, a build log, PCB anatomy and discussing open source licenses: https://linustechtips.com/topic/1366493-elixivy-a-65-mechanical-keyboard-build-log-pcb-anatomy-and-how-i-open-sourced-this-project/

 

mini_cardboard: a 4% keyboard build log and how keyboards workhttps://linustechtips.com/topic/1328547-mini_cardboard-a-4-keyboard-build-log-and-how-keyboards-work/

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×