Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Change date range default starting point #3356


User avatar
0
joe704la created

I am using the date range in another view in my Angular 2 app. Is there away to default the date range to the last 30 days instead of today? For my use in the particular instance it makes more sense to use last 30 days instead.


5 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can change it here <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/blob/master/angular/src/app/shared/common/timing/date-range-picker.component.ts#L16">https://github.com/aspnetzero/aspnet-ze ... ent.ts#L16</a>.

    Thanks.

  • User Avatar
    0
    joe704la created

    I don't want to change it globally though. Just for a specific instance of the date range picker. Is there a way to do that?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Then when you are using dateRangePicker in your component, you can bind any date to it's startDate property.

    <date-range-picker [(startDate)]="startDate" [(endDate)]="endDate"></date-range-picker>
    

    Thanks.

  • User Avatar
    0
    joe704la created

    Perfect. I basically did something like this and it worked for me.

    public startDate: moment.Moment = moment().subtract(29, 'days').startOf('day');
        public endDate: moment.Moment = moment().endOf("day");
    

    Thank you

  • User Avatar
    0
    ismcagdas created
    Support Team

    Great :)