namespace-ee / react-calendar-timeline

A modern and responsive react timeline component.
MIT License
1.91k stars 613 forks source link

Provide a week view to the DateHeader component with unit="primaryHeader". #906

Open livain18 opened 1 year ago

livain18 commented 1 year ago

Problem: I need to show a week view in the dynamic DateHeader Component with unit='primaryHeader', it looks like this is missing in the source code.

Fix: I can solve by editing the source code itself by adding week string into getNextEdit function: react-calndar-timeline > src > utility: line 145

export function getNextUnit(unit) {
  let nextUnits = {
    second: 'minute',
    minute: 'hour',
    hour: 'day',
    day: 'week',
    week: 'month',
    month: 'year',
    year: 'year'
  }
  if (!nextUnits[unit]) {
    throw new Error(`unit ${unit} in not acceptable`)
  }
  return nextUnits[unit]
}

Is it possible to change this to the package please?

Week is missing in today's code. Is it possible to provide this? Or at least give me an option how to reach this by implementing a CustomHeader with the functionality of the DateHeader as a "primaryHeader". Because I find it impossible untill now to achieve this. Thanks in advance!