Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(calendar-view): add week prefix #208

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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