fix(payment): adjust date formatting to use UTC offset for consistency
This commit is contained in:
@@ -99,6 +99,7 @@ export default function PaymentDetailsPage() {
|
||||
const formatDate = (timestamp) => {
|
||||
const date = new Date(parseInt(timestamp) * 1000);
|
||||
return new Intl.DateTimeFormat("fa-IR", {
|
||||
timeZone: "Asia/Tehran",
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
|
||||
@@ -16,7 +16,7 @@ function Detail({ doctor, step, setStep, selectedSlot, selectedDate }) {
|
||||
|
||||
// فرمت کردن تاریخ به شمسی
|
||||
const formattedDate = selectedDate
|
||||
? moment.unix(selectedDate).locale('fa').format('jDD jMMMM jYYYY')
|
||||
? moment.unix(selectedDate).utcOffset(210).locale('fa').format('jDD jMMMM jYYYY')
|
||||
: "تاریخ انتخاب نشده";
|
||||
|
||||
// فرمت کردن زمان
|
||||
|
||||
@@ -92,9 +92,10 @@ function Paying({ setStep, appointmentId, expiresAt, doctor, data, isForAnother,
|
||||
<div className="flex justify-between items-center text-[14px] md:text-[15px]">
|
||||
<span className="text-[#9B9B9B]">زمان نوبت</span>
|
||||
<span className="text-[#3B3B3B] font-medium" dir="rtl">
|
||||
{moment.unix(selectedSlot.start).locale("fa").format("dddd jD jMMMM jYYYY")}
|
||||
{/* utcOffset(210) = ساعت رسمی ایران (+03:30)، مستقل از tz مرورگر بیمار */}
|
||||
{moment.unix(selectedSlot.start).utcOffset(210).locale("fa").format("dddd jD jMMMM jYYYY")}
|
||||
{" — ساعت "}
|
||||
{moment.unix(selectedSlot.start).format("HH:mm")}
|
||||
{moment.unix(selectedSlot.start).utcOffset(210).format("HH:mm")}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user