A newbie question, how to get the current date values year, month, day (not just the datestamp today), just once onClick (not repeating every second, every minute, hour, …)
I read the document of package justinmimbs/date and found an excellent example of calender table but could’nt find solution.
There is a similar question in stackoverflow but there is no case working in elm 0.19.1
Alternatively, how to do it if subscriped from JavaScript?
I made an Ellie showing how this might work… https://ellie-app.com/kwBdRtCMwZ3a1. As @IloSophiep says, it uses the elm/time package, but rather than using Time.here I just assumed Time.utc for the timezone.
Thanks a lot for your quick response and a good example.
I’ll try next to make a module to expose a simple getDate(now) function returning (year, month, day) simply when clicked. I believe, your example in Ellie helps me a lot while doing it.
The module shall be connected to the main module calculating the sun rise / sun set times etc here, where I must input the dates always manually.
Thank you for helpful info. Having now that so as the example by @sparksp I think I know how to get the date and the current time.
I found that time can be easily extended with date.
Time.toMonth can be converted to Int and further to String using Case as in the Ellie example by @sparksp .