Page 1 of 1
Tomorrow's date
Posted: Thu Sep 22, 2022 2:52 am
by adale
What might be the simplest method to determine tomorrow's date?
I want to use the MD datetime (calendar) weblet, and set the MinDate to be tomorrow.
In my old WAM's or S/M, I could use the BIF FindDate, but not quite sure what intrinsic would be best ( or easiest) to the same in a View/Dialog.
Re: Tomorrow's date
Posted: Thu Sep 22, 2022 3:16 am
by Dino
Hi Dale
That would be a control no weblet, if you are using it in a web page, view, dialog...
This code will do it, just bring the date control to the screen and use the adjust intrinsic:
Code: Select all
Begin_Com Role(*EXTENDS #PRIM_WEB) Theme(#SYS_THEME<MaterialDesignBlue>)
Define_Com Class(#PRIM_MD.DateTime) Name(#Date) Caption('Date') DateFormat(Long) DisplayPosition(1) Icon('date_range') IconOpacity(50) Left(102) Parent(#COM_OWNER) TabPosition(1) Top(47) Width(290)
Evtroutine Handling(#Com_owner.Initialize)
#Date.MinDate := #DATEX.Now.Adjust( +1 )
Endroutine
End_Com
as you can see the previous days including today are block from be selected:

- dateminimumtomorrow.png (32.15 KiB) Viewed 10528 times
Re: Tomorrow's date
Posted: Sat Sep 24, 2022 7:30 am
by adale
Dino,
That worked perfect.
Thanks!
Re: Tomorrow's date
Posted: Fri Oct 07, 2022 4:40 am
by adale
Dino,
How about "yesterday's date"? Shouldn't this work the same, but -1 instead of +1?
In a .prepare evtroutine, I have the following to set the current date for the weblet, and the MaxDate for the weblet to be yesterday (-1), and am printing out the #DATEX value to the console for review.
Code: Select all
* Console - debug
#sys_web.Console.Log( ('LINE-298: ' + ' - ' + #DATEX.Now.AsString) )
* Set select & max select date as yesterady
#dtSelect.MaxDate := #DATEX.Now.Adjust( -1 )
#dtSelect := #DATEX.Now.Adjust( -1 )
The console output shows:
LINE-298: - 2022-10-06
But the weblet shows the current selected date, and will only update or change to 10/4, not 10/5? It looks as if it recognizes 10/5 as the MaxDate, but will not let me select it?

- date_weblet.JPG (22.39 KiB) Viewed 10041 times
Re: Tomorrow's date
Posted: Sat Oct 08, 2022 4:37 am
by adale
In regards to "yesterday's date", I have tried several options to get the weblet to display or look correct.
The underlying data values are correct, just the weblet display is off by one day???
Here is what I am currently using to set the weblet to yesterday's date:
Code: Select all
* Set weblet to yesterday's date
#inputDate := #DATEX.Now.Adjust( -1 )
I have tried variations without the .Now, but it didn't seem to make a difference.
Todays date: 10/07/2022
Adjusted date should be: 10/06/2022
date value as recorded in text field: 10/06/2022
Web shows 10/5/2022 as select date?

- date_weblet_adjust.JPG (11.79 KiB) Viewed 9958 times
I found a similar post so maybe this a bug?
viewtopic.php?f=3&t=1187&p=2079&hilit=datetime#p2071