fix(admin): Jalali dates in grids and legacy order-status tags
The API sends ISO timestamps where legacy sent formatted Jalali strings, so every grid printed "2026-07-25T12:32:29.000Z". Date columns now render 1405/5/3-16:02. The order-status column is a green/red «فعال/عدم سفارش» tag again (Customer::$STS), not bare «مجاز». Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
29084904e9
commit
38ce3d2488
@@ -60,6 +60,19 @@ export function jdate(val: unknown) {
|
||||
}
|
||||
|
||||
/** Jalali date+time. Legacy used 12-hour 'hh' here — preserved. */
|
||||
/**
|
||||
* A date column in an XTable grid. The legacy API sent `caj`/`uaj`/… already
|
||||
* formatted (Selector::convertDate, Jalalian) and the grid printed the string;
|
||||
* the new API sends an ISO timestamp, which the grid printed raw
|
||||
* ("2026-07-25T12:32:29.000Z"). Same shape the legacy screen shows:
|
||||
* 1405/5/3-16:02, in the viewer's local (Tehran) time. Anything that is not
|
||||
* an ISO timestamp is returned untouched.
|
||||
*/
|
||||
export function gridDate(val: unknown) {
|
||||
if (typeof val !== 'string' || !/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(val)) return val;
|
||||
return moment(val).format('jYYYY/jM/jD-HH:mm');
|
||||
}
|
||||
|
||||
export function jdateTime(val: unknown) {
|
||||
if (val) {
|
||||
return moment(val as string).format('jYYYY/jMM/jDD - hh:mm:ss');
|
||||
|
||||
Reference in New Issue
Block a user