I have an object with one of its attributes (disponibilidade) having its values in hours, in the format hh:mm (07:30). So that I can do the sum, I do manipulations to put the data in decimal format hh.mm (7.30). However, when I can the sum aggregation function, it calculates the values as decimal - as expected - and in the last line it is possible to find values after the decimal point equal to or above 60 (which would indicate an extra hour). Does anyone know how I can do the sum the hours correctly?
I have an object with one of its attributes (disponibilidade) having its values in hours, in the format hh:mm (07:30). So that I can do the sum, I do manipulations to put the data in decimal format hh.mm (7.30). However, when I can the sum aggregation function, it calculates the values as decimal - as expected - and in the last line it is possible to find values after the decimal point equal to or above 60 (which would indicate an extra hour). Does anyone know how I can do the sum the hours correctly?
My Code:
$(function(){ var tpl = $.pivotUtilities.aggregatorTemplates; $('#tb-disponibilidade').pivotUI( result, { rows: ["operador"], cols: ["dias_uteis"], aggregators: { "SomaHoras": function(){ var resultFinal = tpl.sum()(["disponibilidade"]) return resultFinal; } }, aggregatorName: "SomaHoras", vals: ["disponibilidade"] } ) })