import moment from "jalali-moment";
import React from "react";

const FormatJalaliDateEn = (date, noYear) => {
  const jalaliDateDay = moment(date).format("D");
  const jalaliDateYear = moment(date).format("YYYY");

  // Extract day name
  const dayName = moment(date).format("dddd");

  let result = null;

  // Map English day names to Persian

  // Get the Persian day name

  // Extract month name
  const monthName = moment(date).format("MMMM");

  if (noYear) {
    result = `${dayName} ${jalaliDateDay} ${monthName}`;
  } else {
    result = `${dayName} ${jalaliDateDay} ${monthName} ${jalaliDateYear}`;
  }

  return result;
};

export default FormatJalaliDateEn;
