import moment from "moment";

// temperature
export const kelvinToFarenheit = (kelvin: number) => {
    return Math.round(((kelvin - 273.15) * 1.8) + 32);
}
//aqi
export const air_QualityIndex = [
    {
        rating: 10,
        desc: "good",        
    },
    {
        rating: 20,
        desc: "good",        
    },
    {
        rating: 30,
        desc: "moderate",        
    },
    {
        rating: 40,
        desc: "moderate",        
    },
    {
        rating: 50,
        desc: "unhealthy",        
    },
    {
        rating: 60,
        desc: "unhealthy",        
    },
    {
        rating: 70,
        desc: "very unhealthy",        
    },
    {
        rating: 80,
        desc: "very unhealthy",        
    },
    {
        rating: 100,
        desc: "Hazardous",        
    }
]
//sunset-sunrise
export const unixToTime = (unix: number, timezone: number) => {
    return moment.unix(unix).utcOffset(timezone / 60).format("hh:mm");
};

export const unixToDay = (unix: number) => {
    return moment.unix(unix).format("ddd");
}

