Decimal-date-time not working in web form

641
4
Jump to solution
03-29-2022 06:43 AM
AnthonyJonesRSK
Occasional Contributor II

Hi all,

I was hoping someone could help me as I'm struggling to get dates to work in the web form. I have a survey that is pulling in data using the javascript functionality including some dates, which are coming into my form in epoch time format e.g. 1325635200000. After reviewing Ismael's blog post here and the help section on decimal date time I've attempted to convert my epoch date using the decimal-date-time function. My set up can be seen below N.B. I split up the calculations to see where the issue was occurring but originally just had one field with a single combined calculation.

AnthonyJones5_0-1648560934582.png

In Survey123 Connect, this all works fine (see below) but in the web form I find that the decimal-date-time calculation simply won't fire (see second image below). 

AnthonyJones5_1-1648561006789.png

AnthonyJones5_2-1648561042313.png

I've tried various combinations on this and none of them seem to work. I even went back and tried the example Ismael proposed in his blog post below and had no joy with this. Can someone please look at this and let me know if I'm doing anything wrong or is there currently a bug in the S123 web form that is preventing this from working? Any help on this would be very much appreciated. Thanks, Anthony

AnthonyJones5_3-1648561130287.png

@IsmaelChivite @Anonymous User 

 

0 Kudos
1 Solution

Accepted Solutions
AndrewO_support
New Contributor

Hello @Anthony and @DoZ

I was able to get this to work by dividing the epoch timestamp by 86,400,000 (1000 * 60 * 60 * 24) and then using the date() function to convert to a date object. Let me know if that works for you!

-Andrew

View solution in original post

4 Replies
DoZ
by
New Contributor III

Hi Anthony,

 

I am struggling with some thing very similar to your case. Have you menage to find a solution or a workaround? Did you get any feedback outside the esri community?

Thank you very much,

Dory

0 Kudos
AnthonyJonesRSK
Occasional Contributor II

Hi Dory, 

Unfortunately I never got a response on this and ended up removing the date element from my form. I can imagine there may be a way to convert the date in the javascript but I'm pretty much a novice with javascript so wouldn't know how. I suspect this issue may persist though when people are using the new pulldata from a feature service functionality as I'd assume any dates pulled into a json will also be in the UNIX epoch format although I haven't had chance to test it out yet.

Hi @IsmaelChivite @Anonymous User, sorry for tagging you both again but I was wondering if the issue described above is a recognised bug or are we doing something wrong? Any help would be much appreciated.

Kind Regards

Anthony

0 Kudos
AndrewO_support
New Contributor

Hello @Anthony and @DoZ

I was able to get this to work by dividing the epoch timestamp by 86,400,000 (1000 * 60 * 60 * 24) and then using the date() function to convert to a date object. Let me know if that works for you!

-Andrew

AnthonyJonesRSK
Occasional Contributor II

Hi Andrew,

Thank you so much for your response, I've managed to replicate that with my form. Just wish I'd thought of that 10 months ago!

I'll be bookmarking this page so I can remind myself the next time I forget how to do it!

Thanks again,

Anthony