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

Uncaught TypeError: Cannot read property 'L' of undefined moment.js 2.8 #451

Closed
mkutgt72 opened this issue Aug 4, 2014 · 6 comments
Closed

Comments

@mkutgt72
Copy link

mkutgt72 commented Aug 4, 2014

https://github.com/Eonasdan/bootstrap-datetimepicker/blob/master/src/js/bootstrap-datetimepicker.js#L104

Example:

<script type="text/javascript" src="js/moment-with-langs.js"></script>
<script type="text/javascript" src="js/bootstrap-datetimepicker.js"></script>
<script type="text/javascript" src="js/locales/bootstrap-datetimepicker.ru.js"></script>

<script type="text/javascript">
  $(function(){
    var now = new Date();

    var nowMinusSeven = new Date(now.getTime() - (7 * 24 * 60 * 60 * 1000));
    var nowPlusSeven = new Date(now.getTime() + (7 * 24 * 60 * 60 * 1000));

    var dp = $('#dpicker').datetimepicker({
      startDate: nowMinusSeven,
      endDate: nowPlusSeven,
      language: 'ru',
      autoclose: true,
      pickTime: false,
    }).datetimepicker().data("DateTimePicker");
  };
</script>

<div class="input-group date col-xs-12" id="dpicker" data-date-format="DD.MM.YYYY">
  <input class="form-control" size="16" type="text" name="date" readonly />
  <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
</div>
@nikoskalogridis
Copy link
Contributor

update your moment.js library to 2.8.1, and also update your datetimepicker library you are using an old version. Get the locale files from moment since they were removed duplicates in bootstrap-datetimepicker

@ghost
Copy link

ghost commented Aug 4, 2014

Getting the same error with moment 2.8.1 and bootstrap-datetimepicker 3.0.1, cache busted.
Not using langs and I'm aware that I'm still using the deprecated add/subtract syntax.

<div class="input-group date datetimepicker-birthday" data-date-format="DD. MM. YYYY">
    <input class="form-control" placeholder="DD. MM. YYYY" type="text" name="birthday">
    <span class="input-group-btn">
        <button class="btn btn-default"><i class="fa fa-calendar fa-fw"></i></button>
    </span>
</div>
$('.datetimepicker-birthday').datetimepicker({
    pickTime: false,
    useCurrent: false,
    minDate: moment().subtract('years', 100).subtract('days', 1),
    maxDate: moment()
});

@nikoskalogridis
Copy link
Contributor

@mkutgt72 and @msnk, can you please checkout from development branch and let me know if that fixes your issues? thanks

nikoskalogridis added a commit that referenced this issue Aug 4, 2014
@nikoskalogridis
Copy link
Contributor

fixed in v.3.0.2

@mkutgt72
Copy link
Author

mkutgt72 commented Aug 4, 2014

@nikoskalogridis thanks!

@ghost
Copy link

ghost commented Aug 4, 2014

@nikoskalogridis Thanks for the fix, sorry for not checking out the dev branch fast enough.

@ghost ghost locked and limited conversation to collaborators Jun 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants