Skip to content

Commit

Permalink
feat(calendar-view): add week prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
Ves-as committed Sep 22, 2023
1 parent e287736 commit ca970cb
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ npm start
| preStepsCount | number | Specifies empty space before the fist task |
| locale | string | Specifies the month name language. Able formats: ISO 639-2, Java Locale. |
| rtl | boolean | Sets rtl mode. |
| weekPrefix | string | Set the prefix of the week (Default 'W'). |

### StylingOption

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/components/calendar/calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import styles from "./calendar.module.css";
export type CalendarProps = {
dateSetup: DateSetup;
locale: string;
weekPrefix: string;
viewMode: ViewMode;
rtl: boolean;
headerHeight: number;
Expand All @@ -31,6 +32,7 @@ export const Calendar: React.FC<CalendarProps> = ({
columnWidth,
fontFamily,
fontSize,
weekPrefix,
}) => {
const getCalendarValuesForYear = () => {
const topValues: ReactChild[] = [];
Expand Down Expand Up @@ -179,7 +181,7 @@ export const Calendar: React.FC<CalendarProps> = ({
topValue = `${getLocaleMonth(date, locale)}, ${date.getFullYear()}`;
}
// bottom
const bottomValue = `W${getWeekNumberISO8601(date)}`;
const bottomValue = `${weekPrefix}${getWeekNumberISO8601(date)}`;

bottomValues.push(
<text
Expand Down
2 changes: 2 additions & 0 deletions src/components/gantt/gantt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const Gantt: React.FunctionComponent<GanttProps> = ({
viewMode = ViewMode.Day,
preStepsCount = 1,
locale = "en-GB",
weekPrefix = 'W',
barFill = 60,
barCornerRadius = 3,
barProgressColor = "#a3a3ff",
Expand Down Expand Up @@ -405,6 +406,7 @@ export const Gantt: React.FunctionComponent<GanttProps> = ({
fontFamily,
fontSize,
rtl,
weekPrefix,
};
const barProps: TaskGanttContentProps = {
tasks: barTasks,
Expand Down
1 change: 1 addition & 0 deletions src/types/public-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export interface DisplayOption {
* Specifies the month name language. Able formats: ISO 639-2, Java Locale
*/
locale?: string;
weekPrefix?: string;
rtl?: boolean;
}

Expand Down

0 comments on commit ca970cb

Please sign in to comment.