Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
ManuelRauber committed Sep 5, 2024
2 parents 758303f + 970505a commit ce86b1a
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions src/app/components/settings/settings.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,30 +50,32 @@ export default class SettingsComponent {
const today = DateTime.now().set({ hour: 0, minute: 0, second: 0, millisecond: 0 });
const startDay = today.minus({ day: days });
const items = await firstValueFrom(this.timeTable.groupByDay$(startDay.toMillis(), today.toMillis()));
const rows = items.flatMap(item => [
const rows = [
['Date', 'Start Time', 'End Time', 'Duration', 'Is A Day Off?', 'Is a non work day?', 'description'],
...item.items.map(timeEntry => [
DateTime.fromMillis(item.utcDate).toISODate(),
DateTime.fromMillis(timeEntry.start).toISOTime({
includeOffset: false,
includePrefix: false,
suppressMilliseconds: true,
suppressSeconds: true,
extendedZone: false,
}),
DateTime.fromMillis(timeEntry.end).toISOTime({
includeOffset: false,
includePrefix: false,
suppressMilliseconds: true,
suppressSeconds: true,
extendedZone: false,
}),
millisecondsToHumanReadable(timeEntry.duration.toMillis()),
timeEntry.isADayOff,
timeEntry.isNonWorkday,
timeEntry.description,
...items.flatMap(item => [
...item.items.map(timeEntry => [
DateTime.fromMillis(item.utcDate).toISODate(),
DateTime.fromMillis(timeEntry.start).toISOTime({
includeOffset: false,
includePrefix: false,
suppressMilliseconds: true,
suppressSeconds: true,
extendedZone: false,
}),
DateTime.fromMillis(timeEntry.end).toISOTime({
includeOffset: false,
includePrefix: false,
suppressMilliseconds: true,
suppressSeconds: true,
extendedZone: false,
}),
millisecondsToHumanReadable(timeEntry.duration.toMillis()),
timeEntry.isADayOff,
timeEntry.isNonWorkday,
timeEntry.description,
]),
]),
]);
];

const csv = rows.map(row => row.join(',')).join('\n');
const csvBlob = new Blob([csv], { type: 'text/csv;charset=utf-8' });
Expand Down

0 comments on commit ce86b1a

Please sign in to comment.