React-big-calendar: moment localizer ignores culture setting on time ranges

Created on 5 Apr 2016  路  4Comments  路  Source: jquense/react-big-calendar

See Lines #15 #16 on moment.js. 'h.mma' is always used and and always produces AM/PM regardless culture setting

Most helpful comment

Without implementing the PR above one could apply the following formatters as a prop to the calendar:

formats={{
  eventTimeRangeFormat: ({ start, end }, culture, localizer) => (
    `${localizer.format(start, "LT")} - ${localizer.format(end, "LT")}`
  ),
  agendaTimeRangeFormat: ({ start, end }, culture, localizer) => (
    `${localizer.format(start, "LT")} - ${localizer.format(end, "LT")}`
  )
}}

All 4 comments

This issue is a bit annoying

It seems like _LT_ would work better than any other _h:mma_ variation. _LT_ is the localized format for time as specified in the MomentJS docs.

The localized version _L_ is used in the _dateRangeFormat_ method but not the _timeRangeFormat_ which this issue is about.

Any downside to changing this?

Without implementing the PR above one could apply the following formatters as a prop to the calendar:

formats={{
  eventTimeRangeFormat: ({ start, end }, culture, localizer) => (
    `${localizer.format(start, "LT")} - ${localizer.format(end, "LT")}`
  ),
  agendaTimeRangeFormat: ({ start, end }, culture, localizer) => (
    `${localizer.format(start, "LT")} - ${localizer.format(end, "LT")}`
  )
}}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

zhming0 picture zhming0  路  3Comments

kweisamx picture kweisamx  路  4Comments

The-Oracle picture The-Oracle  路  3Comments

dogC76 picture dogC76  路  4Comments

npalansky picture npalansky  路  3Comments