Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Leap year coding issue (perhaps)
#1
Seattle10
Intraweb 15.0.23
FastReports 5.0
TMS Intraweb PRO Components
Raize 6.2.1


Has anybody encountered a leap year issue while using IncYear function for dates.

I have a problem where if the start date is 12/30/19 or 12/31/2019 and I use the  IncYear function to auto populate the end date to 12/30/2020 or 12/31/2020 then the application does not submit. Dates before and after work fine i.e 12/29/2019 and 01/01/2020 get the end date and the application submits the users request.

I have tested it several times and end up with the same results. Appreciate any hekp I can get. For now we are handling these situations manually but I'm intrigued by this situationa dn the only thing I can think would cause this problem would be that 2020 is a leap year.

Thoughts?


Thanks
Reply
#2
IW doenst parse dates AFAIK as a data type during submit and you also have a lot of 3P components involved. You will need to narrow it down a bit as to where it gets stuck or if there are any errors.
Reply
#3
(01-16-2020, 03:42 PM)msgopala Wrote: Seattle10
Intraweb 15.0.23
FastReports 5.0
TMS Intraweb PRO Components
Raize 6.2.1


Has anybody encountered a leap year issue while using IncYear function for dates.

I have a problem where if the start date is 12/30/19 or 12/31/2019 and I use the  IncYear function to auto populate the end date to 12/30/2020 or 12/31/2020 then the application does not submit. Dates before and after work fine i.e 12/29/2019 and 01/01/2020 get the end date and the application submits the users request.

I have tested it several times and end up with the same results. Appreciate any hekp I can get. For now we are handling these situations manually but I'm intrigued by this situationa dn the only thing I can think would cause this problem would be that 2020 is a leap year.

Thoughts?


Thanks

Did you test the same in a simple VCL application? I'm not sure if there is a bug in IncYear() in Delphi 10 Seattle, but nothing is impossible....
Reply
#4
Delphi has a built-in function

if IsLeapYear(2000)
  then

also you can use


try

  DateToStr; StrToDate

except

  correct the date according to your needs by adding or substracting one day

end
Reply
#5
Could this be related to your issue?

https://www.youtube.com/watch?v=D3jxx8Yyw1c
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)