Spaces:
Sleeping
Sleeping
File size: 1,046 Bytes
57a9d02 2b3e7de | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | /** Para birimi ve tarih string yardımcıları. */
export function money(value) {
return `${Number(value || 0).toFixed(2)} TL`;
}
/** Sipariş listesinde kesinti hücreleri: tutar hep gider gibi (-) ile. */
export function moneyDeduction(value) {
const n = Number(value ?? 0);
if (!Number.isFinite(n) || n === 0) return `${(0).toFixed(2)} TL`;
return `${(-Math.abs(n)).toFixed(2)} TL`;
}
export function currentDateValue() {
return new Date().toISOString().slice(0, 10);
}
export function currentMonthValue() {
return new Date().toISOString().slice(0, 7);
}
const TR_MONTH_NAMES = [
"Ocak",
"Subat",
"Mart",
"Nisan",
"Mayis",
"Haziran",
"Temmuz",
"Agustos",
"Eylul",
"Ekim",
"Kasim",
"Aralik",
];
/** YYYY-MM → "Eylul 2026" */
export function formatMonthLabel(monthValue) {
if (!monthValue || typeof monthValue !== "string") return "";
const [y, m] = monthValue.split("-");
const idx = Number(m) - 1;
if (!y || idx < 0 || idx > 11) return monthValue;
return `${TR_MONTH_NAMES[idx]} ${y}`;
}
|