Twine Version: 2.3.16
Story Format: 2.36.1
I recently (with the help of @pbparjeter) got the time and date to not only appear in the sidebar, but to update when I navigated. i.e.: https://intfiction.org/t/best-easiest-method-for-time-and-date-usage
Now I have a new issue, which I had not factored into my initial request for help.
Can I use this existing code (which works, so I seriously hope I don’t have to change it) and be able to set things like:
- birthdays,
- holidays,
- opening and closing hours for shops,
- dates for rent to be paid,
- dates for wages to be received,
- time and/or dates for meetings etc
To recap my current code:
In StoryInit:
<<set $CurDate to new Date('August 19, 1575 23:15:30')>>
In StoryCaption:
Date: <<print $CurDate>>
In Widgets, including the tag Widget:
<<widget "minutes_incr">>
<<set $CurDate_inc to new Date(Math.trunc($CurDate) + $args[0] * 60 * 1000)>> <<set $CurDate to $CurDate_inc>>
<</widget>>
<<widget "check_date">>
<<set $CheckDateA to new Date($args[0])>>
<<set $CheckDateB to new Date($args[1])>>
<<if Math.trunc($CurDate) gte Math.trunc($CheckDateA) and Math.trunc($CurDate) lt Math.trunc($CheckDateB)>>
<<print $args[2]>>
<<endif>>
<</widget>>
And as a sample of my buttons:
<<button "  Home  ">><<minutes_incr 30>><<fatigue_change +2>><<goto "Room 23">><</button>> (30 min)
If I have to recode the time and date code in order to make this work, I will, but I’m really hoping this can be used intact.