Skip to content

Default for dateFormat property of calendar falsely overrides individual setting #4374

@femto-code

Description

@femto-code
  • Framework7 version: 9.0.3
  • Platform and Target: Chrome Browser, PWA/WebApp in iOS style mode

Describe the bug

The dateFormat property set on an individually created calendar component gets ignored if a "default" is set on the app instance. According to the docs, defaults can be specified for all components via setting them on the app instance. However, in this case setting the app "default" discards any individually set property value for dateFormat.

To Reproduce

Steps to reproduce the behavior:

  1. Create a calendar component (see code below)
  2. Specify a dateFormat default via app.js (see below)
  3. Define a dateFormat for the calendar instance itself directly (see below)
  4. See how the app "default" overrides the locally defined value

Expected behavior

The value provided to dateFormat on the app instance should provide a default in case no individual value is assigned on the calendar instance. If the value itself is set, it should NOT overwrite it.

Actual Behavior

The app instance property value overrides the individual setting, discarding the purpose of a "default".

Additional context

On a router component / page:

const dateInput = $f7.calendar.create({
    inputEl: '#input',
    dateFormat: {
      weekday: 'short',
      year: 'numeric',
      month: 'long',
      day: '2-digit',
      hour: '2-digit',
      minute: '2-digit'
    }
});

In app.js:

const app = new Framework7({
    ...
    calendar: { dateFormat: { weekday: 'short' } }
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions