<?php
// app/Helpers/info_helper.php
use CodeIgniter\CodeIgniter;

function float_seconds_to_hhmm_string(?float $time):?string 
{
    $time_str = null;
    if($time){
        $time_str = sprintf("%02d:%02d",$time/3600,floor($time/60)%60);
    }
    return $time_str;
}

function week_day_humanize(int $week_day,bool $upper = false) : string
{
    $week_days = ["Lunes","Martes","Miércoles","Jueves","Viernes","Sábado","Domingo"];
    $week_day_string = "";
    if(in_array($week_day,range(0,6))){
        $week_day_string = $week_days[$week_day];
    }
    if($upper){
        $week_day_string = strtoupper($week_day_string);
    }
    return $week_day_string;
}