Skip to content

Commit

Permalink
feat: Added localization for timeaxis
Browse files Browse the repository at this point in the history
  • Loading branch information
Xeyos88 committed Jan 2, 2025
1 parent 4833909 commit 5c97b62
Show file tree
Hide file tree
Showing 15 changed files with 10,762 additions and 2,064 deletions.
1 change: 1 addition & 0 deletions docs/api/props.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ interface VisualProps {
highlightedDaysInMonth?: number[]; // Array of days to highlight (1-31)
highlightedMonths?: number[]; // Array of months to highlight (0-11, 0 is January)
highlightedWeek?: number[]; // Array of weeks to highlight (1-53)
locale?: string; // Locale for dayjs
}
```

Expand Down
1 change: 1 addition & 0 deletions docs/components/g-gantt-chart.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Here's a minimal example of using the GGanttChart component:
| rowClass| `(row: ChartRow) => string` | `` | Method to add classes to data rows |
| rowLabelClass| `(row: ChartRow) => string` | `` | Method to add classes to label rows |
| dayOptionLabel| `DayOptionLabel[]` | `['day']` | Customization for time unit day |
| locale| `string` | `'en'` | Locale for dayjs |


### Events
Expand Down
29 changes: 7 additions & 22 deletions docs/guide/time-axis.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,12 @@ You can customize the time scale appearance:

```typescript
<g-gantt-chart
:highlight-today="true"
:highlight-weekends="true"
:custom-timeaxis-format="customFormat"
:day-option-label="['day', 'name', 'doy']"
:highlighted-hours="[9, 10, 11, 12, 13, 14, 15, 16, 17]"
:highlighted-days-in-week="[0, 6]"
:highlighted-days-in-month="[1, 15, 30]"
:highlighted-months="[0, 6]"
:holiday-highlight="'US'"
:locale="'en'"
/>

const customFormat = (date: Date, precision: TimeUnit) => {
// Your custom formatting logic
return formattedDate;
};
```

## Working with Time Zones

The time axis respects the local time zone by default. For specific time zone handling:

```typescript
// Using day.js for time zone support
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
import timezone from 'dayjs/plugin/timezone';

dayjs.extend(utc);
dayjs.extend(timezone);
```
Loading

0 comments on commit 5c97b62

Please sign in to comment.