
const path = require("path");

// const getConfig = require("next/config");
// exports.nextconfig = getConfig();
// const { serverRuntimeConfig } = getConfig();
// const { serverRuntimeConfig, publicRuntimeConfig } = require('next/config').default();


exports.contentPath = path.join(__dirname, "../../content") + path.sep;

// ------------------  constants exports ------------------
exports.monthNamesBG = [
  "Януари",
  "Февруари",
  "Март",
  "Април",
  "Май",
  "Юни",
  "Юли",
  "Август",
  "Септември",
  "Октомври",
  "Ноември",
  "Декември",
];
exports.weekdaysBG = [
  "Неделя",
  "Понеделник",
  "Вторник",
  "Сряда",
  "Четвъртък",
  "Петък",
  "Събота",
];

exports.IsDateXMonthsAgo = function (date, months) {
  var date = new Date(date);
  var now = new Date();
  var diff = now.getTime() - date.getTime();
  var diffMonths = Math.floor(diff / (1000 * 60 * 60 * 24 * 30));
  return diffMonths >= months;
};


exports.GetDateFormat = function (datetime) {
  var datetime = new Date(datetime);
  return `${datetime.getDate()}.${datetime.getMonth()}.${datetime.getFullYear()}`;
};

//Getdate in format 20221215T120000Z
exports.GetDateTimeShort = function (datetime) {
  var datetime = new Date(datetime);
  return `${datetime.getFullYear()}${String(datetime.getMonth() + 1).padStart(
    2,
    "0"
  )}${String(datetime.getDate()).padStart(2, "0")}T${String(
    datetime.getHours()
  ).padStart(2, "0")}${String(datetime.getMinutes()).padStart(2, "0")}${String(
    datetime.getSeconds()
  ).padStart(2, "0")}`;
};

//Getdate in format HH:mm
exports.GetTimeFormat = function (datetime) {
  //get date in format HH:mm
  var datetime = new Date(datetime);
  return `${String(datetime.getHours()).padStart(2, "0")}:${String(
    datetime.getMinutes()
  ).padStart(2, "0")}`;
};


