withCalendar method

LocalDatePattern withCalendar(
  1. CalendarSystem calendar
)

Creates a pattern like this one, but with the template value modified to use the specified calendar system.

Care should be taken in two (relatively rare) scenarios. Although the default template value is supported by all Time Machine calendar systems, if a pattern is created with a different template value and then this method is called with a calendar system which doesn't support that date, an exception will be thrown. Additionally, if the pattern only specifies some date fields, it's possible that the new template value will not be suitable for all values.

  • calendar: The calendar system to convert the template value into.

Returns: A new pattern with a template value in the specified calendar system.

Implementation

LocalDatePattern withCalendar(CalendarSystem calendar) => withTemplateValue(templateValue.withCalendar(calendar));