-
1. Re: Determine if end date is after start date
$Nith$ Oct 30, 2014 6:28 AM (in response to Paul Dokken)This should work..
var sDate = BackgroundInformation.Background.CheckingDateStart.value.date.value;
var eDate = BackgroundInformation.Background.CheckingDateEnd.value.date.value;
xfa.host.messageBox("eDate:"+eDate+" sDate:"+sDate);
if(sDate > eDate)
{ valid = false; fieldName +="Start Date is greater than End Date"; } -
2. Re: Determine if end date is after start date
$Nith$ Oct 30, 2014 6:29 AM (in response to Paul Dokken)I'm assuming that you are using DateTime field in your form..
-Nith
-
3. Re: Determine if end date is after start date
Magus069 Oct 30, 2014 6:40 AM (in response to Paul Dokken)Hi there, I would suggest you to use FormCalc to do so, it is much more easier to work with date using this language...
By using FormCalc language you can use the following functions:
Date2Num() & Num2Date()
if ($.rawValue <> null & dateEnd.rawValue <> null) then
var end= Date2Num(dateEnd.rawValue, "YYYY-MM-DD")
var start = Date2Num($.rawValue, "YYYY-MM-DD")
if (start gt 0)then
if (start gt end)then
xfa.host.messageBox("The start date is after the end date. Please change dates.", "Information", 0)
else
xfa.host.messageBox(Concat("Start Date: ", Num2Date(startDate, "YYYY-MM-DD"), " End Date: ", Num2Date(endDate, "YYYY-MM-DD")))
endif
endif
endif
Hope this help!
-
4. Re: Determine if end date is after start date
Paul Dokken Oct 30, 2014 8:12 PM (in response to Paul Dokken)Thank you so much for the answer. It worked!
-
5. Re: Determine if end date is after start date
Paul Dokken Oct 30, 2014 8:13 PM (in response to Magus069)Unfortunately I am using Javascript already. I don't think you can mix FormCalc and JS.


