public static Optional<String> convertJavaFormatToJs(final String javaFormatStr) {
        if (javaFormatStr != null) {
            try {
                final StringBuilder outputBuilder = new StringBuilder();
                final StringBuilder scratchBuilder = new StringBuilder();
                char lastChar = Character.MIN_VALUE;
                for (int i = 0; i < javaFormatStr.length(); i++) {
                    char currChar = javaFormatStr.charAt(i);
                    parseChar(outputBuilder, scratchBuilder, lastChar, currChar);
                    lastChar = currChar;
                }
                // Force it to consider the last char seen
                parseChar(outputBuilder, scratchBuilder, lastChar, Character.MIN_VALUE);
                final String jsDateFormatStr = outputBuilder.toString();

                return Optional.of(jsDateFormatStr);
            } catch (Exception e) {
                GWT.log("Unable to convert '" + javaFormatStr + "' due to: " + e.getMessage());
                return Optional.empty();
            }
        } else {
            return Optional.empty();
        }
    }
Converts a java syntax date format string into a moment.js syntax date format
string. May not handle all cases so it is possible the output will not be valid
syntax.
stroom-core-client-widget/src/main/java/stroom/widget/customdatebox/client/ClientDateUtil.java