perbaikan tanggal UCT
This commit is contained in:
@@ -24,6 +24,16 @@
|
||||
</p>
|
||||
</ng-template>
|
||||
</ngx-datatable-column>
|
||||
<ngx-datatable-column name="periode" [flexGrow]="1" [minWidth]="90">
|
||||
<ng-template ngx-datatable-header-template>
|
||||
<span style="color: #ffffff !important">Tanggal</span>
|
||||
</ng-template>
|
||||
<ng-template let-value="value" ngx-datatable-cell-template>
|
||||
<p style="color: #ffffff !important">
|
||||
{{ value | date : "dd/MM/yyyy" }}
|
||||
</p>
|
||||
</ng-template>
|
||||
</ngx-datatable-column>
|
||||
<ngx-datatable-column name="deviceName" [flexGrow]="1" [minWidth]="90">
|
||||
<ng-template ngx-datatable-header-template>
|
||||
<span style="color: #ffffff !important">Device</span>
|
||||
@@ -106,16 +116,6 @@
|
||||
</p>
|
||||
</ng-template>
|
||||
</ngx-datatable-column>
|
||||
<ngx-datatable-column name="periode" [flexGrow]="1" [minWidth]="90">
|
||||
<ng-template ngx-datatable-header-template>
|
||||
<span style="color: #ffffff !important">Tanggal</span>
|
||||
</ng-template>
|
||||
<ng-template let-value="value" ngx-datatable-cell-template>
|
||||
<p style="color: #ffffff !important">
|
||||
{{ value | date : "dd/MM/yyyy" }}
|
||||
</p>
|
||||
</ng-template>
|
||||
</ngx-datatable-column>
|
||||
</ngx-datatable>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -28,7 +28,8 @@ export class ModalExportComponent {
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.formattedEndDate = this.dataRow.endDate.slice(0, 7);
|
||||
const dateRow = this.convertToUTC7(this.dataRow.endDate)
|
||||
this.formattedEndDate = dateRow.slice(0, 7);
|
||||
}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
@@ -45,6 +46,7 @@ export class ModalExportComponent {
|
||||
.getCostDetail(category, room, period)
|
||||
.subscribe((response) => {
|
||||
this.dataExport = response.data;
|
||||
console.log(this.dataExport);
|
||||
this.data_cost = response.data.map((item) => ({
|
||||
deviceName: item.device_name,
|
||||
roomName: item.room_name,
|
||||
@@ -54,27 +56,39 @@ export class ModalExportComponent {
|
||||
watt: item.watt,
|
||||
duration: item.duration,
|
||||
priceKwh: item.price_kwh,
|
||||
periode: item.periode,
|
||||
// periode: item.periode,
|
||||
periode: this.convertToUTC7(item.periode)
|
||||
}));
|
||||
console.log(this.data_cost);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
convertToUTC7(dateString: string): string {
|
||||
const date = new Date(dateString);
|
||||
const utc7Offset = 7 * 60; // UTC+7 in minutes
|
||||
const localOffset = date.getTimezoneOffset();
|
||||
const totalOffset = utc7Offset - localOffset;
|
||||
const utc7Date = new Date(date.getTime() + totalOffset * 60 * 1000);
|
||||
return utc7Date.toISOString();
|
||||
}
|
||||
|
||||
export() {
|
||||
this.spinnerExportActive = true;
|
||||
setTimeout(() => {
|
||||
const columnsToExport = [
|
||||
"device_name",
|
||||
"room_name",
|
||||
"category_name",
|
||||
"estimation_cost",
|
||||
"total_kwh",
|
||||
"periode",
|
||||
"deviceName",
|
||||
"roomName",
|
||||
"categoryName",
|
||||
"estimationCost",
|
||||
"totalKwh",
|
||||
"watt",
|
||||
"duration",
|
||||
"price_kwh",
|
||||
"periode",
|
||||
"priceKwh",
|
||||
];
|
||||
this.tableexcelService.exportAsExcelFileManageDetail(
|
||||
this.dataExport,
|
||||
this.data_cost,
|
||||
"export_detail_cost_management",
|
||||
columnsToExport
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user