开发者

formatTime with "h" instead of ":" as separator

开发者 https://www.devze.com 2023-03-09 10:58 出处:网络
We use the following 24 hour format for time in Portugal: 18h30. I\'ve tried: timeFormat: \'H\'h\'(mm)\'

We use the following 24 hour format for time in Portugal: 18h30. I've tried:

timeFormat: 'H'h'(mm)'
timeFormat: {'H开发者_C百科'h'(mm)'}
timeFormat: 'H\h(mm)'

Is it possible? Thank you.


You need to use single quotes inside the javascript string to insert the letter h as literal text. The easiest way for this is to use double quotes as string delimiters, as in:

timeFormat: "H'h'(mm)"

For reference, if you want to use single quotes inside a single quoted string, use an escape for each quote, as in:

timeFormat: 'H\'h\'(mm)'


An up-to-date solution is reported here and works for FullCalendar2: formatTime with “h” instead of “:” as separator

Escaping Characters:

To escape characters in format strings, you can wrap the characters in square brackets.

moment().format('[today] dddd'); // 'today Sunday'

This works for the formatTime fullcalendar option too:

timeFormat: 'H[h](mm)'
0

精彩评论

暂无评论...
验证码 换一张
取 消