Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

Date Generated glitch in Footer?

super1236
Level 2
Level 2

Today I ran across an issue where the date generated on the last page of the report was one day in the future,even though the report was run at 8:30 this morning.

Here is the code that is present in the master pages:

// Current Date in short-style date format.

$.rawValue = num2date(date(), DateFmt(1))

I ran the same report about an hour ago and all the dates were fine, today's date. Has anyone seen this before?

4 Replies
Gaurav-Behl
Community Advisor
Community Advisor

This code seems to be written using jQuery. The client-side library code would always run in the browser and would be impacted by timezones as you are generating date on client-side and not on server-side (specifically if you work on VPN/Cloud).

$.rawValue = num2date(date(), DateFmt(1))

Probably, this could be the reason for this behavior.

super1236
Level 2
Level 2

Thank you, but why it would only be on one page and not all pages? We also just figured out that if we restart the browser the problem is solved. Dates appear as expected.

Gaurav-Behl
Community Advisor
Community Advisor

If it doesn't work for one page then I assume the design of that page/component could be the root cause. How is that component setup?

If you restart the browser and it gets fixed, then most likely it uses either non-persistent/session based cookie or token or sessionStorage which gets wiped out as soon as the browser is closed.

I'm sure when you go through that component/s design, you'll definitely find more clues.

super1236
Level 2
Level 2

I have a solution to my problem.

First, don't use FormCalc. FormCalc running the code I was using leads to the inconsistent timestamps in the future.

Switching to Javascript and leveraging custom code to generate the timestamp resolved our problem.