Merge pull request '修改订单导出时间错误' (#40) from dev_jacy into dev
CI / verify (pull_request) Waiting to run
CI / verify (pull_request) Waiting to run
Reviewed-on: https://git.yqidian.com/jacy/dukang/pulls/40
This commit was merged in pull request #40.
This commit is contained in:
@@ -48,9 +48,14 @@ function formatBenefitBrief(order: {
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 导出给运营看的时间:按上海时区,避免 toISOString() 落成 UTC(少 8 小时) */
|
||||||
|
function formatShanghaiDateTime(value: Date): string {
|
||||||
|
return value.toLocaleString('sv-SE', { timeZone: 'Asia/Shanghai' });
|
||||||
|
}
|
||||||
|
|
||||||
export function formatExportDateTime(value?: Date | null): string {
|
export function formatExportDateTime(value?: Date | null): string {
|
||||||
if (!value) return '';
|
if (!value) return '';
|
||||||
return value.toISOString().slice(0, 19).replace('T', ' ');
|
return formatShanghaiDateTime(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function mapOrderToExportRow(order: {
|
export function mapOrderToExportRow(order: {
|
||||||
@@ -206,6 +211,6 @@ export async function buildOrdersPdf(rows: OrderExportRow[]): Promise<Buffer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function buildExportFilename(format: 'xlsx' | 'pdf', count: number): string {
|
export function buildExportFilename(format: 'xlsx' | 'pdf', count: number): string {
|
||||||
const stamp = new Date().toISOString().slice(0, 10);
|
const stamp = formatShanghaiDateTime(new Date()).slice(0, 10);
|
||||||
return `订单导出_${stamp}_${count}条.${format}`;
|
return `订单导出_${stamp}_${count}条.${format}`;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user