2013 to 2016 Form Error

  • 12 July 2022
  • 8 replies
  • 145 views

Userlevel 3
Badge +8

Hi all, We're migrating from SharePoint 2013 to 2016 and have ran into an issue while testing forms in the 2016 environment. In new, view and edit, the classic form is throwing this error: "date1.getTimezoneOffset is not a function" 

 

We aren't sure which function is causing the error but we have three calculations that may be the culprit:

1. If(and(equals(RequestType,"Job Jar"),or(isNullOrEmpty(RequestedTime),isNullOrEmpty(RequestedRestorationTime))),"For job jar requests, please provide the earliest dates this could occur. (Minimum of two business days)","")
2. If(equals(lookup("Pre-Arranged", "DateTitle", formatDate(RequestedTime,"yyyyMMdd") +"Not Allowed", "Approved Time"),""),"",If(and(not(CommercialAffected),not(ResidentialAffected)),"","No impact allowed on this date."))
3. If(equals(lookup("Pre-Arranged", "DateRegion", formatDate(RequestedTime,"yyyyMMddHH") + Region + "Yes" + "Specific Date", "Approved Time"),""),"","Another request is already scheduled for this hour in " + Region +" region. Please choose another time or call the Coordinator to negotiate.") 

 

I removed and re-added the formulas to see if it would resolve the issue with no luck. 

 

It could also be something on the back end because the function it's referencing is updating to local time from UTC. I tried to recreate the error in another classic form and date fields, but could not. 

 

Any thoughts on what's causing this?

 

Thanks

Kassie

 


8 replies

Userlevel 3
Badge +8

ok, I've figured out that it's the dateDiffDays function that is causing this error and have recreated the issue with other classic forms. 


Has anyone else experienced an issue with this function in forms when upgrading from 2013 to 2016? If so, what is the solution? 


 


Thanks again,


Kassie

Badge

We encountered a similar error after upgrading to Nintex Forms version 5.2.2.70 last night.


Some of our forms are using the formula dateDiffDays and the {Common:CurrentDate} system property. e.g. dateDiffDays(Commencementdate, {Common:CurrentDate}). It was working yesterday prior to the patch.


I found changing {Common:CurrentDate} to another form property resolved the issue.


My workaround was to create a calculated property and set it to {Common:CurrentDate}. I then reference THAT calculated field in my dateDiffDays formula.


I have submitted a helpdesk ticket with Nintex to ask whether the previously available functionality can be restored. The initial response was, 'we see you have found a solution, can we close the ticket now?'.

Userlevel 3
Badge +8

I agree, the workaround is not a long-term solution. We have built so many forms, it would be difficult to find and change every one using this function in one of the formulas. 


 


It's a built in function, it needs to work. Our admin opened a ticket with Nintex as well. Maybe it will get more attention now that there's more than one...

Badge

Excellent. I've now been informed support have been able to replicate the issue and have referred it to the development team.

Badge +2
Aug 31 and support says there is still no fix.
Userlevel 3
Badge +8

yea, it's taking a while for a fix. 😕


 


The workaround posted above does work though. I'm not sure if you're formula calc allows it. 


Here's a screenshot of mine.


The new calculated field to get the current date:



 


Then I replaced all the current date references in my formula with "TodaysDate" calculated field value. It's working now. 


 


If(not(equals(RequestType,"Job Jar")),If(equals(formatDate(TodaysDate,"dddd"),"Monday"),dateDiffDays(TodaysDate,RequestedSwitchingTime),dateDiffDays(TodaysDate,RequestedSwitchingTime)-2),If(or(equals(formatDate(TodaysDate,"dddd"),"Thursday"),equals(formatDate(TodaysDate,"dddd"),"Friday")),dateDiffDays(TodaysDate,RequestedSwitchingTime)-2,dateDiffDays(TodaysDate,RequestedSwitchingTime)))


 

Userlevel 3
Badge +8

Just found a workflow with a build string action using the "fn-DateDiffDays" while testing our 2016 environment pre-upgrade. This function isn't working in workflows either, and the workaround doesn't work if I try to set a variable to capture the current date, then use that in the formula. 


 


Any thoughts on a workaround for the function not working in workflows?


 


Thanks!

Badge

We might need someone else with SharePoint 2016 to test.


The formula seems to be working in Nintex Forms and Nintex Workflows in SharePoint 2019.


Nintex Forms version 5.2.2.70.


 


A workaround would be the following but the DateDiffDays would be preferable by far:


(Date2 - Date1) / (1000 * 60 * 60 * 24)


or


(Date2 - Date1) / 86400000


*Assuming 'Date2' is always the later date. Otherwise we have to add if statements to change the order.


 


If you can email or post an example of your calculation step I could test that and see if I can replicate.


I've attached the successful fn-DateDiffDays formula usage in our environment.

Reply