Editing of the project's Kariz page
This commit is contained in:
@@ -144,6 +144,16 @@ export function formatClock(d: Date | string | null | undefined) {
|
||||
return `${String(date.getHours()).padStart(2, '0')}:${String(date.getMinutes()).padStart(2, '0')}`;
|
||||
}
|
||||
|
||||
export function parseAmount(raw?: string): number | null {
|
||||
const text = toAsciiDigits(raw ?? '')
|
||||
.replace(/[,،]/g, '')
|
||||
.replace(/\s+/g, '')
|
||||
.trim();
|
||||
if (!text) return null;
|
||||
const n = Number(text.replace(/[^\d.-]/g, ''));
|
||||
return Number.isFinite(n) ? n : null;
|
||||
}
|
||||
|
||||
export function parseJalaliDateTime(dateRaw?: string, timeRaw?: string): Date | null {
|
||||
const dateText = toAsciiDigits(dateRaw ?? '').trim();
|
||||
if (!dateText) return null;
|
||||
|
||||
Reference in New Issue
Block a user