Project

Profile

Help

Support #4888

closed

Getting current-dateTime()/js:Date() in UI/browser

Added by David Cramer over 3 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Low
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
2021-02-01
Due date:
% Done:

0%

Estimated time:
Applies to JS Branch:
Fix Committed on JS Branch:
Fixed in JS Release:
SEF Generated with:
Platforms:
Company:
-
Contact person:
-
Additional contact persons:
-

Description

I have a UI in which I would like to display some duration info along side certain dates. E.g. "Today at 4:00 pm (2 minutes ago)". Implementing this in xslt is easy enough, however the UI should really update this text as time marches on. If your browser stays open, at some point it should say "Yesterday at 4:00 pm (9 hours ago)".

The problem is that current-dateTime() always returns the time at which the window was loaded. I assume this is a 'no side-effects' thing. I've tried implementing a JavaScript function that returns Date().toISOString(). That works when the pages is loaded, but when the function is called a second time I'm getting "XError:ixsl:call: property 'isoDate' is not a function; code:SXJS0007"

This is pretty common thing to do in a UI, so I assume there's a way to do it with Saxon-JS that I haven't figured out. Any guidance would be appreciated!

Please register to edit this issue

Also available in: Atom PDF Tracking page