选择其他选项时,ejs daterangepicker不显示日历

时间:2019-11-27 07:17:19

标签: angular daterangepicker angular-daterangepicker

.html文件:

<ejs-daterangepicker placeholder='Select a range'>
   <e-presets>
      <e-preset label="This Week" [start]='weekStart' [end]='weekEnd'></e-preset>
      <e-preset label="This Month" [start]='monthStart' [end]='monthEnd'></e-preset>
      <e-preset label="Last Month" [start]='lastStart' [end]='lastEnd'></e-preset>
      <e-preset label="Last Year" [start]='yearStart' [end]='yearEnd'></e-preset>
   </e-presets>
</ejs-daterangepicker>

.ts文件:

public today: Date = new Date(new Date().toDateString());
public weekStart: Date = new Date(new Date(new Date().setDate(new Date().getDate() - (new Date().getDay() + 7) % 7)).toDateString());
public weekEnd: Date = new Date(new Date(new Date().setDate(new Date(new Date().setDate((new Date().getDate() - (new Date().getDay() + 7) % 7))).getDate() + 6)).toDateString());
public monthStart: Date = new Date(new Date(new Date().setDate(1)).toDateString());
public monthEnd: Date = this.today;
public lastStart: Date = new Date(new Date(new Date(new Date().setMonth(new Date().getMonth() - 1)).setDate(1)).toDateString());
public lastEnd: Date = this.today;
public yearStart: Date = new Date(new Date(new Date().setDate(new Date().getDate() - 365)).toDateString());
public yearEnd: Date = this.today;

每当我选择“自定义范围”选项以外的其他选项(本周或本月,其他)时,都不会显示日历。我想每次显示压光机,然后在压光机中选择该范围,无论人们选择什么选项。

0 个答案:

没有答案