Skip to content

Commit be0ab3b

Browse files
committed
formatting report params
1 parent 98ad926 commit be0ab3b

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tabbled-server",
3-
"version": "0.4.0",
3+
"version": "0.4.1",
44
"public": true,
55
"license": "MIT",
66
"scripts": {

src/reports/reports.service.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {style} from "./report.style";
1212
import { DataSourceV2Service } from "../datasources/datasourceV2.service";
1313
import * as Mustache from "mustache"
1414
import { ReportEntity } from "./entities/report.entity";
15+
import * as dayjs from "dayjs";
1516

1617

1718

@@ -287,6 +288,20 @@ export class ReportsService {
287288
}
288289
}
289290

291+
if (data.params) {
292+
let params = Object.keys(data.params)
293+
for(let i in params) {
294+
let param = params[i]
295+
let config = report.parameters.find(f => f.alias === param)
296+
if (config) {
297+
switch (config.type) {
298+
case "date": data.params[param] = dayjs(data.params[param], 'YYYYMMDD').format('DD.MM.YYYY'); break;
299+
case "datetime": dayjs(data.params[param]).format('DD.MM.YYYY hh:mm:ss'); break;
300+
}
301+
}
302+
}
303+
}
304+
290305
return data
291306
}
292307

0 commit comments

Comments
 (0)