Tomorrow's date

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
adale
Posts: 212
Joined: Wed Apr 08, 2020 9:18 pm
Location: Poplarville, MS

Tomorrow's date

Post 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.
Arlyn Dale
Servias LLC
User avatar
Dino
Posts: 477
Joined: Fri Jul 19, 2019 7:49 am
Location: Robbinsville, NC
Contact:

Re: Tomorrow's date

Post 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
dateminimumtomorrow.png (32.15 KiB) Viewed 10524 times
adale
Posts: 212
Joined: Wed Apr 08, 2020 9:18 pm
Location: Poplarville, MS

Re: Tomorrow's date

Post by adale »

Dino,
That worked perfect.
Thanks!
Arlyn Dale
Servias LLC
adale
Posts: 212
Joined: Wed Apr 08, 2020 9:18 pm
Location: Poplarville, MS

Re: Tomorrow's date

Post 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
date_weblet.JPG (22.39 KiB) Viewed 10037 times
Arlyn Dale
Servias LLC
adale
Posts: 212
Joined: Wed Apr 08, 2020 9:18 pm
Location: Poplarville, MS

Re: Tomorrow's date

Post 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
date_weblet_adjust.JPG (11.79 KiB) Viewed 9954 times
I found a similar post so maybe this a bug?
viewtopic.php?f=3&t=1187&p=2079&hilit=datetime#p2071
Arlyn Dale
Servias LLC
Post Reply