Aktueller Stand - Datumsberechnungen
This commit is contained in:
parent
2ccca9e981
commit
574398344a
@ -5,6 +5,7 @@ import { ChartComponent } from './chart/chart.component';
|
|||||||
import { RestService } from './rest.service';
|
import { RestService } from './rest.service';
|
||||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
|
import { endOfMonth, format, startOfMonth, subMonths } from 'date-fns';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
@ -49,6 +50,22 @@ export class AppComponent implements OnInit, OnChanges {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testFunction(): string {
|
||||||
|
let startThisMonth: Date = subMonths(startOfMonth(new Date()), 1);
|
||||||
|
let returnValue: string = '';
|
||||||
|
for (let i = 0; i < 12; i++) {
|
||||||
|
let endThisMonth: Date = endOfMonth(startThisMonth);
|
||||||
|
returnValue += ' / ' + format(startThisMonth, 'dd.MM.yyyy HH:mm:ss')
|
||||||
|
+ ' - ' + format(endThisMonth, 'dd.MM.yyyy HH:mm:ss')
|
||||||
|
+ ' (' + startThisMonth.getTime() + ' - ' + endThisMonth.getTime() + ')<br>';
|
||||||
|
startThisMonth = subMonths(startThisMonth, 1);
|
||||||
|
}
|
||||||
|
return returnValue;
|
||||||
|
}
|
||||||
|
|
||||||
houseId: number | undefined = undefined;
|
houseId: number | undefined = undefined;
|
||||||
duration: number | undefined = undefined;
|
duration: number | undefined = undefined;
|
||||||
|
|
||||||
|
startThisMonth: Date = startOfMonth(new Date());
|
||||||
|
testDate: string = '';
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user