Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

first open on model date #46

Closed
tmx976 opened this issue Sep 25, 2015 · 1 comment
Closed

first open on model date #46

tmx976 opened this issue Sep 25, 2015 · 1 comment

Comments

@tmx976
Copy link

tmx976 commented Sep 25, 2015

It seems to me that the first open refer today, and not the model in the input form.

that's how i changed your init() to acheive this

          init = function() {
            var days, endDate, firstMonday;

            var initDate=scope.date ? moment(scope.date) : moment();

            firstMonday = initDate.clone();
            firstMonday = firstMonday.date(1).startOf('isoweek');
            if (firstMonday.date() === 1) {
              firstMonday.subtract(1, 'weeks');
            }
            days = initDate.date(1).daysInMonth();
            endDate = initDate.clone();
            endDate = endDate.add(1, 'months').date(0);
            scope.month = $filter('date')(new Date(endDate), 'MMM');
            if (endDate.day() !== 7) {
              endDate = endDate.add(7 - endDate.day(), 'days');
            }
            scope.currentDate = firstMonday;
            scope.year=initDate.year();
            return scope.weeks = getWeeks(endDate.diff(firstMonday, 'days'), firstMonday, initDate.month());
          };
@mobinni
Copy link
Owner

mobinni commented Sep 25, 2015

create a pull request

@mobinni mobinni closed this as completed Sep 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants