Fix detection of 24 hour format

Moment.js allows to escape characters by enclosing them in brackets. The expression used to determine whether to use the 24 hour format wasn't able to distinguish between escaped and unescaped characters. By using a regular expression it's possible to match the characters "h" and "a" (that signal to use the 12 hour format) only outside of brackets.