从十进制小时到正常小时的 CRM 转换

CRM convertion from decimal hour to normal hour

我正在尝试使用函数 Split() 来分隔“.”前后。这样我就可以将小数分钟转换为普通分钟。

这是我正在尝试做的事情:

function formataHora() {
    //first i get the value in minutes
    var duracaoEmMinutos = Xrm.Page.getAttribute("smart_duracaodoevento").getValue();
    //from minutes to hours
    var emHoras = duracaoEmMinutos / 60;
    //i'm getting like 2.80 hours, so i'm trying to use spli(".") to separate 2 from 80
    var horaSeparada = emHoras.split(".")
    var minutosMaisSegundos = horaSeparada[1] * 60;
    //separating minutes from seconds
    var minutos = minutosMaisSegundos.split(".");
    //putting formated hour plus minutes together
    var horaFormatada = horaSeparada[0] + "," + minutos[0];
    Xrm.Page.getAttribute("smart_duracaodoevento").setValue(horaFormatada);
}   

脚本运行时,出现错误:TypeError: Object doesn't support property or method 'split' at formataHora

是我操作有误还是CRM真的不支持Split()功能?

提前致谢!

您正在尝试拆分号码。

此调整将解决错误:

var horaSeparada = emHoras.toString().split(".");