import starData from "@/components/MyScene/Chunk/data.json"

export const formatDateTime = (value:string) =>{
  const date = new Date(value)
  function pad(number: number) {
    if (number < 10) {
        return '0' + number;
    }
    return number;
  }

  const day = pad(date.getDate());
  const month = pad(date.getMonth() + 1); // Month is zero-indexed
  const year = date.getFullYear();
  const hours = pad(date.getHours());
  const minutes = pad(date.getMinutes());
  const seconds = pad(date.getSeconds());

  return `${year}/${month}/${day} ${hours}:${minutes}:${seconds}`;

}

export const getConstellation = (value:number) =>{
  const names = starData.names
  const k = Math.floor((value-1)/5)
  return names[k]
}