render date for Javascript with moment.js

Description

We want to display datetime in a consistent way across OpenNMS ( NMS-10072 ).
On the client side we decided to use moment.js ( https://momentjs.com/docs/#/displaying/ )

Therefore we need to do the following:

  1. add moment.js as a dependency

  2. add a mapping between the java.time.format.DateTimeFormatter format and moment.js format, e.g. similar to: https://github.com/MadMG/moment-jdateformatparser/blob/master/moment-jdateformatparser.js#L50 (we can't use this plugin since it translates java.util.SimpledateFormat instead of java.time.format.DateTimeFormatter which has a slightly different Syntax)

  3. retrieve the dateformat and timezone from the rest endpoint, see https://issues.opennms.org/browse/NMS-10301

  4. apply the format to places where plain (not Angular and not Vaadin) Javascript renders dates

An alternative to 4. could be to replace the plain Javascript with a mini Angular application since we want to move all Javascript to Angular anyway?

Acceptance / Success Criteria

None

Lucidchart Diagrams

Activity

Benjamin Reed August 1, 2018 at 3:45 PM

Considering Angular is already always loaded by the web UI, it's probably fine to make a little application.  But we might as well make a directive anyways.

Fixed

Details

Assignee

Reporter

Sprint

Priority

PagerDuty

Created June 28, 2018 at 1:35 AM
Updated August 22, 2018 at 2:05 PM
Resolved August 22, 2018 at 2:05 PM

Flag notifications