Date Control value is previous day

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
paularstall
Posts: 7
Joined: Tue Oct 09, 2018 2:09 am

Date Control value is previous day

Post by paularstall » Thu Jun 11, 2020 10:24 pm

Hi.

I'm having a strange problem trying to get the date value returned from the PRIM_MD.DateTime control.

When the users selects a date from the calendar it correctly displays on the screen, however when I try and assign the value to another field it always displays the previous days date.
I'm in the UK could this be a timezone issue?

User selects 8th June 2020
DateSelect.PNG
DateSelect.PNG (7.36 KiB) Viewed 313 times
After Clicking save I can see the value of the control using a console log
ConsoleLog.PNG
ConsoleLog.PNG (5.08 KiB) Viewed 313 times
The value is showing as 7th June 2020

Here's the relevant code

Code: Select all

Define_Com Class(#PRIM_MD.DateTime) Name(#ResponseDate) Caption('Date') Displayposition(2) Icon('date_range') Iconopacity(50) Left(253) Parent(#AnswerPanel) Tabposition(3) Width(300) Themedrawstyle('LightTitle') Top(46) Dateformat(Custom) Customdateformat('DDDD, D MMM YYYY')


Evtroutine Handling(#SaveResponse.Click)
#ApptDateFormat := #ResponseDate.value.AsDisplayString( CCYYMMDDHHMMSS )
#ApptDatex := #ResponseDate.Value
#SYS_WEB.console.log Text('Save Clicked Date - ' + #ApptDatex.AsString + ' - ' + #ApptSlot)
#SYS_WEB.console.log Text('Date Format - ' + #ApptDateFormat)
Endroutine
Any ideas what's going on here, and what I can do to fix it?
I'm at the point of forgetting the control altogether and just having the user type the date.

Cheers
Paul.

jyoung
Posts: 687
Joined: Thu Jan 21, 2016 6:43 am
Location: Oklahoma City, OK USA

Re: Date Control value is previous day

Post by jyoung » Thu Jun 11, 2020 11:39 pm

I had the same issue some time ago and I raised an issue with support, this was before the Idera acquisition and the move to the new support system, however I think the solution was to use the STD_DATEX field instead of the PRIM_MD.DateTime.

I forget the exact details as to why, but it was something with how they were treating ISO dates (i think :S)

Might give STD_DATEX a try and see if you get the correct results.

Hope this helps,
Joe

paularstall
Posts: 7
Joined: Tue Oct 09, 2018 2:09 am

Re: Date Control value is previous day

Post by paularstall » Fri Jun 12, 2020 12:28 am

Thanks Joe
I'll give that a try :)

paularstall
Posts: 7
Joined: Tue Oct 09, 2018 2:09 am

Re: Date Control value is previous day

Post by paularstall » Fri Jun 12, 2020 12:40 am

Hi Joe.

Many thanks for that. It now works perfectly :!:

Thanks
Paul.

Post Reply