To count the days till the new year, you can use JavaScript's built-in Date
object to get the current date and time, then calculate the difference between that and the first day of the next year.
Here's the code:
index.tsx641 chars19 lines
This code gets the current date, determines the next year, creates a new Date
object for the first day of next year, calculates the difference between that and the current date in milliseconds, converts that to days, and finally outputs the result as a message to the console.
gistlibby LogSnag