JSFiddle - React, Tailwind, and code Playground

JavaScript

// got from https://kalender-365.de/leap-years.php should be updated accordingly
const IS_LEAP_YEAR = {
  1972: true,
  1976: true,
  1980: true,
  1984: true,
  1988: true,
  1992: true,
  1996: true,
  2000: true,
  2004: true,
  2008: true,
  2012: true,
  2016: true,
  2020: true,
  2024: true,
  2028: true,
};

const MONTH_DAYS = [
  -9999,
  31,
  28,
  31,
  30,
  31,
  30,
  31,
  31,
  30,
  31,
  30,
  31,
  30,
  31,
];

const MONTH_NAMES = [
  "THERE_IS_NO_ZERO_MONTH",
  "January",
  "February",
  "March",
  "April",
  "May",
  "June",
  "July",
  "August",
  "September",
  "October",
  "November",
  "December",
];

const DAY_NAMES = [
  "Sunday",
  "Monday",
  "Tuesday",
  "Wednesday",
  "Thursday",
  "Friday",
  "Saturday",
];

function strToTime(time = 683475320, strFormat = "A d B Y") {
  let date = { year: 1970, month: 1, day: 1, hour: 0, minute: 0, second: 0 };

  //optimizer code
  let minutes = Math.floor(time / 60);
  date.second = time % 60;

  //first iteration was second-based, took too long, optimized x60!!!!
  for (let i = 0; i < minutes; i++) {
    // date.second += 1;

    // if (date.second > 59) {
    //   date.second = 0;
    //   date.minute += 1;
    // }

    date.minute += 1;

    if (date.minute > 59) {
      date.minute = 0;
      date.hour += 1;
    }

    if (date.hour > 23) {
      date.hour = 0;
      date.day += 1;
    }

    if (date.day > MONTH_DAYS[date.month]) {
      //gracefully checking for leap year
      if (date.month == 1 && IS_LEAP_YEAR[date.year]) {
        if (date.day > MONTH_DAYS[date.month] + 1) {
          date.day = 1;
          date.month += 1;
        }
      } else {
        date.day = 1;
        date.month += 1;
      }
    }

    if (date.month > 12) {
      date.month = 1;
      date.year += 1;
    }
  }

  return(
    date,
    strFormat
      .split("")
      .map((letter) => {
        if (letter == "d") {
          //padding
          return date.day.toString().length == 1 ? "0" + date.day :...