Skip to content
This repository was archived by the owner on Dec 16, 2019. It is now read-only.
This repository was archived by the owner on Dec 16, 2019. It is now read-only.

Default date range not working. #122

@raalveco

Description

@raalveco

I have implemented the library, but I have a problem to set the default date range when I try to set the default for the current month range, in my controller I have this:

$scope.filters = {
company_id: 0,
service_type_id: 0,
status: 0,
dates: { startDate: moment().startOf('month'), endDate: moment().endOf('month') }
};

In my view I have the following code:

<input type="daterange" ng-model="filters.dates" ranges="ranges" locale="locale" ng-change="changeRange()"/>

Image Example: http://prntscr.com/c27e9q

If I define a similar variable, but do not put in the ng-model of input, variable prints correctly with the values defined in the controller, but when used in the ngmodel, this is changed by a range that only
contemplates the day from today.

$scope.filters = {
company_id: 0,
service_type_id: 0,
status: 0,
dates: { startDate: moment().startOf('month'), endDate: moment().endOf('month') },
another_dates: { startDate: moment().startOf('month'), endDate: moment().endOf('month') }
};

{{filters.another_dates}}<input type="daterange" ng-model="filters.dates" ranges="ranges" locale="locale" ng-change="changeRange()"/>

Image Example: http://prntscr.com/c27gy6

For some reason the ng-model resets the variable scope and assigns a default value different than I had defined.

I would also like to know if there is a way to define an empty value and not pre-load by default today's date.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions