Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Date Generated glitch in Footer?

Avatar

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

Avatar

Level 10

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.

Avatar

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.

Avatar

Level 10

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.

Avatar

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.