Skip to content

Commit

Permalink
Improve import
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinschopf committed Mar 7, 2021
1 parent 27ac4c0 commit 9abe7f4
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,24 @@ class Hours extends React.Component<Props> {
moment().day("Monday").toDate()
);
let iteratorChanges = [];
let latestChange;
while (
ohIterator.advance(moment().day("Monday").add(1, "week").toDate())
) {
if (ohIterator.getState() === true) {
if (ohIterator.getNextChange()) {
iteratorChanges.push({
from: ohIterator.getDate(),
to: ohIterator.getNextChange().getDate(),
});
} else {
iteratorChanges.push({
from: ohIterator.getDate(),
});
if (latestChange) {
if (
ohIterator.getState() === false &&
latestChange.state === true
) {
latestChange.to = ohIterator.getDate();
iteratorChanges.push(latestChange);
latestChange = null;
}
} else {
latestChange = {
state: ohIterator.getState(),
from: ohIterator.getDate(),
};
}
}
console.debug(iteratorChanges);
Expand Down

1 comment on commit 9abe7f4

@vercel
Copy link

@vercel vercel bot commented on 9abe7f4 Mar 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.