Skip to content

Commit

Permalink
add quarter support
Browse files Browse the repository at this point in the history
  • Loading branch information
pro-odoo committed Apr 17, 2024
1 parent c24d1d2 commit ac0f715
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/helpers/pivot/pivot_helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export function getNumberOfPivotFunctions(tokens: Token[]) {

export const PERIODS = {
year: _t("Year"),
// quarter: _t("Quarter"),TODOPRO
quarter: _t("Quarter"),
month: _t("Month"),
// week: _t("Week"),TODOPRO
day: _t("Day"),
Expand Down
1 change: 1 addition & 0 deletions src/helpers/pivot/pivot_runtime_definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function getFormatFromGranularity(granularity: string | undefined): Format {
case "year":
return "yyyy";
case "quarter":
return "qq yyyy";
case "week":
//TODOPRO Not implemented
return "yyyy";
Expand Down
5 changes: 5 additions & 0 deletions src/helpers/pivot/spreadsheet_pivot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ let MAP_VALUE_DIMENSION_DATE: Record<
set: new Set<FieldValue["value"]>(),
values: {},
},
quarter: {
set: new Set<FieldValue["value"]>(),
values: {},
},
month: {
set: new Set<FieldValue["value"]>(),
values: {},
Expand Down Expand Up @@ -104,6 +108,7 @@ function createDate(dimension: PivotDimension, value: FieldValue["value"], local
case "quarter":
// Set the month to the first month of the quarter
dateParts[1] = Math.floor(dateParts[1] / 3) * 3;
dateParts[2] = 1;
break;
case "month":
dateParts[2] = 1;
Expand Down

0 comments on commit ac0f715

Please sign in to comment.