Spaces:
Sleeping
Sleeping
Download frontend/src/lib/format.js from Caner7/Muhasebe: direct link, hf CLI and curl.
- Browser
- Download file 1.05 kB
-
https://huggingface.co/spaces/Caner7/Muhasebe/resolve/main/frontend/src/lib/format.js
- Command line
-
hf download hf://spaces/Caner7/Muhasebe/frontend/src/lib/format.js
-
curl -L -o format.js https://huggingface.co/spaces/Caner7/Muhasebe/resolve/main/frontend/src/lib/format.js
1.05 kB
| /** 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}`; | |
| } | |