Skip to content

Commit

Permalink
feat: 修改日视图的bar长度(#INFR-2013)
Browse files Browse the repository at this point in the history
  • Loading branch information
mengshuicmq authored and HandsomeButterball committed Jun 30, 2021
1 parent a31da21 commit 9ac28e7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/gantt/src/class/item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export class GanttItemInternal {
let _date: GanttDate;
switch (this.viewType) {
case GanttViewType.day:
_date = hasStart ? new GanttDate(date).addDays(7).endOfDay() : new GanttDate(date).addMonths(-7).startOfDay();
_date = hasStart ? new GanttDate(date).endOfDay() : new GanttDate(date).startOfDay();
break;
default:
_date = hasStart ? new GanttDate(date).addMonths(1).endOfDay() : new GanttDate(date).addMonths(-1).startOfDay();
Expand Down
4 changes: 2 additions & 2 deletions packages/gantt/src/class/test/item.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('GanttItemInternal', () => {
expect(ganttItemInternal.end.getUnixTime()).toBe(new GanttDate('2020-06-21 23:59:59').getUnixTime());

ganttItemInternal = new GanttItemInternal(ganttItem, { viewType: GanttViewType.day });
expect(ganttItemInternal.end.getUnixTime()).toBe(new GanttDate('2020-05-28 23:59:59').getUnixTime());
expect(ganttItemInternal.end.getUnixTime()).toBe(new GanttDate('2020-05-21 23:59:59').getUnixTime());
});

it(`should has correct start`, () => {
Expand All @@ -50,7 +50,7 @@ describe('GanttItemInternal', () => {
expect(ganttItemInternal.start.getUnixTime()).toBe(new GanttDate('2020-04-21 00:00:00').getUnixTime());

ganttItemInternal = new GanttItemInternal(ganttItem, { viewType: GanttViewType.day });
expect(ganttItemInternal.start.getUnixTime()).toBe(new GanttDate('2020-05-14 00:00:00').getUnixTime());
expect(ganttItemInternal.start.getUnixTime()).toBe(new GanttDate('2020-05-21 00:00:00').getUnixTime());
});

it(`should update refs`, () => {
Expand Down

0 comments on commit 9ac28e7

Please sign in to comment.