Florin M.
Florin M.

Reputation: 2169

xpages: using javascript library/function

I created a javascript function : Time.js :

  var now = new moment();
console.log(now.format("HH:mm:ss"));

And now I would want to add it on my custom control to see if it works. How to appeal this function/library? Should it be as a default value for a computed field?

Thanks for your attention!

Upvotes: 0

Views: 525

Answers (1)

Brian Gleeson - IBM
Brian Gleeson - IBM

Reputation: 2565

If you simply want to display the current time in a text field, you can use the @Now "at function" as below, with a converter:

<xp:text escape="true" id="computedField1" value="#{javascript:@Now()}">
    <xp:this.converter>
        <xp:convertDateTime type="time"></xp:convertDateTime>
    </xp:this.converter>
</xp:text>

When you say "continuous time & date" though, do you mean you want it to continuously update?

Upvotes: 1

Related Questions