Skip to content

Commit

Permalink
Billing - Small typescript fixes for Safari browser. (#670)
Browse files Browse the repository at this point in the history
* Small typescript fixes for Safari browser.
  • Loading branch information
milo-hyben authored Jan 30, 2024
1 parent 91b5ff7 commit 6134af9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion web/src/pages/billing/BillingInvoiceMonthCost.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ const BillingCurrentCost = () => {
const year = invoiceMonth.substring(0, 4)
const month = invoiceMonth.substring(4, 6)
let nextYear = year
let nextMonth = (parseInt(month, 10) + 1).toString()
let nextMonth = (parseInt(month, 10) + 1).toString().padStart(2, '0')
if (month === '12') {
nextYear = (parseInt(year, 10) + 1).toString()
nextMonth = '01'
Expand Down
5 changes: 3 additions & 2 deletions web/src/shared/components/Graphs/DonutChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,15 @@ export const DonutChart: React.FC<IDonutChartProps> = ({ data, maxSlices, colors
const margin = 15
const radius = Math.min(width, height) / 2 - margin

// keep order of the slices
// keep order of the slices, declare custom sort function to keep order of slices as passed in
// by default pie function starts from index 1 and sorts by value
const pieFnc = pie()
.value((d) => d.value)
.sort((a) => {
if (typeof a === 'object' && a.type === 'inc') {
return 1
}
return -1
return 0 // works both on Safari and Firefox, any other value will break one of them
})
const data_ready = pieFnc(data)
const innerRadius = radius / 1.75 // inner radius of pie, in pixels (non-zero for donut)
Expand Down

0 comments on commit 6134af9

Please sign in to comment.