Hello!
Is it possible to NOT have the year in {formdate} ie Wed 14th Feb without 2024 on the end?
Also, I'm trying to achieve a date and time format like this: Wed 14th Feb between 3.30pm and 5.30pm, but I'm not sure how to do so. I'd like to be able to select the day, date, month and both times.
For example:
Please choose one appointment time from below:
Wed 14th Feb between 3.30pm and 5.30pm
Thu 15th Feb between 10.30am and 12.30pm
Does this make sense?! I'm new to Text Blaze and it!
Please and thank you.
Kylie
Hi @kashtc1x,
Yes, you can do it using {formdate} and {time}.
{note}{formdate: YYYY-MM-DD HH:mm; name=dt1}{formdate: YYYY-MM-DD HH:mm; name=dt2}{endnote}
{time: ddd Do MMM [between] hh:mm a; at={=dt1}} and {time: hh:mm a; at={=dt1}; shift=+120m}
{time: ddd Do MMM [between] hh:mm a; at={=dt2}} and {time: hh:mm a; at={=dt2}; shift=+120m}
You can avoid repetitions of logic to convert the chosen date to the required format for every date by using lambda function.
Click to reveal
{reqformat=(dt)->{time: ddd Do MMM [between] hh:mm a; at={=dt}} & " and " & {time: hh:mm a; at={=dt}; shift=+120m}}{note}{formdate: YYYY-MM-DD HH:mm; name=dt1}{formdate: YYYY-MM-DD HH:mm; name=dt2}{endnote}
{=reqformat(dt1)}
{=reqformat(dt2)}
Let me know if you face any issue.
2 Likes
Wonderful - thank you!
- How do I leave the second time field 'open'? ie so it isn't set to +2hrs, as time slots will vary each time.
- Which part do I copy to make a 3rd date and time option?
I'm brand new to this type of coding and I apologise for such basic questions!
Thank you again
If you want to choose one time and number of continuous slots with a 2-hour gap. You can try this snippet with a loop.
{note}{formdate: YYYY-MM-DD HH:mm; name=dt1}{formtext: name=numslots; default=3}{endnote}
{repeat: for slot in {=seq(1, numslots)}}{time: ddd Do MMM [between] hh:mm a; at={=dt1}; shift=+{=120*(slot-1)}m} and {time: hh:mm a; at={=dt1}; shift=+{=120*slot}m}
{endrepeat}
1 Like