Tempus-dominus: locale is not a function

Created on 28 May 2015  路  8Comments  路  Source: Eonasdan/tempus-dominus

I just updated from v3.0.0 to v4.7.14, just imported the new libs instead of the old.

I'm getting the following error twice:

  • b.locale is not a function (line 8, col 28068)
  • a.locale is not a function (line 8, col 16269)

I searched my site code and I don't seem to be setting the locale any place, as I never had. Is this a known issue / change with the latest code base? How should I resolve it?

Most helpful comment

FYI - updating to the latest version of moment fixes my issue. I had version 2.6.0, and have now updated to version 2.10.3 and the locale error went away.

I did then run into an issue where it wasn't finding my glyphic font files. It seems to expect them in the same location as the CSS file in a fonts sub folder. But we're using font awesome anyway so I just set the icons property on the config.

One thing to mention on your documentation's custom icons section. In the example you show us of time, date, up and down, but no mention of previous or next. It would be helpful to see a full list of the icons you can override. It's easy enough to look in your code but other might not think to do that.

Thanks for your timely responses yesterday. We love using your plugin!

All 8 comments

I think v3 it was lang or something like that in v4 it should be locale. do you have demo page or a fiddle of the issue?

Are you sure you've got the v4 libs?

Thanks for the quick reply. I just downloaded and included the latest code so I'm definitely on v4.7.14.

Just did a app search for "lang" and the only place I use that is in the main tag.

To replicate what I have in a fiddle would be tough. We include your libs in the head, we init all our daytime pickers at one time in another include, then we just use markup all over the site (its kinda a complicated site). We do pass all the config settings in on a single "config" data attribute, then parse that out (I think one of our divs pinged you about that last year sometime).

Here's an example of the markup used:
<div class="enddate input-group date">
<input type="text" data-config="{'pickTime':false,'format':'MM/DD/YYYY', 'defaultDate':''}" id="srEnd" name="srend" class="form-control">
<span class="input-group-addon"><i class="fa fa-calendar fa-fw"></i></span>
</div>
Note this is my v3 code so it includes the pickTime which I also needed to remove.

Here is how we init it all globally in one call:
$(function(){
dtpicker.initDatePicker();
});

var dtpicker = {};
function initDatePicker(){
$('.input-group.date').find('.fa-calendar').css('cursor','pointer');
$('.input-group.date').each(function(){
var config = eval("(" + $(this).find('input').data('config') + ")");
$(this).datetimepicker(config);
$(this).on('click',function(){
$(this).data("DateTimePicker").show()
});
});
}
dtpicker.initDatePicker = initDatePicker;

I hope that gives you a little picture of what we have. If you want to anything else just let me know.
Thanks!

can you look at the console in Chrome (or something) and past a screen cap?

screen shot 2015-05-28 at 4 26 53 pm

Its not very detailed but thats what I get

I assume you have included the latest version of MomentJs?

Can you try the non-minified version?

So we have moment 2.6.0. I see on their site the current version is 2.10.3
We only include: moment.min.js
I am not including moment-with-langs.js nor am I including the any of the lang files. We really only have a need for English. So if thats something the newer code base needs that is probably the issue.

nope that shouldn't be an issue. I'd update your moment version and try the non minified version of the picker to see if you get the same or different errors

FYI - updating to the latest version of moment fixes my issue. I had version 2.6.0, and have now updated to version 2.10.3 and the locale error went away.

I did then run into an issue where it wasn't finding my glyphic font files. It seems to expect them in the same location as the CSS file in a fonts sub folder. But we're using font awesome anyway so I just set the icons property on the config.

One thing to mention on your documentation's custom icons section. In the example you show us of time, date, up and down, but no mention of previous or next. It would be helpful to see a full list of the icons you can override. It's easy enough to look in your code but other might not think to do that.

Thanks for your timely responses yesterday. We love using your plugin!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sabique picture sabique  路  5Comments

callum-resdiary picture callum-resdiary  路  4Comments

jnm2 picture jnm2  路  5Comments

sjvisschers picture sjvisschers  路  5Comments

ravindrabr picture ravindrabr  路  6Comments