Closed multiwebinc closed 5 years ago
Found issues with this. Closing.
Ok, that should do it.
I understand what you want, but this PR only covers your specific use case.
I'd rather make title_format
accepting a callback function, in which case instead of format_date
it would call options.title_format(local_date, options.locales[options.locale])
.
This will allow you to customize year in future too if necessary with any kind of custom logic you might want there.
Ok, that appears to work for me. Here's an example for adding a class to the year if it is not the current year:
{
title_format: function(date, locale) {
var m = date.getMonth();
var y = date.getFullYear();
var cur_date = new Date();
var not_current_year = (y != cur_date.getFullYear()) ? 'not-current-year' : '';
return '<span class="pmu-month-text">' + locale.months[m] + '</span>\
<span class="pmu-year-text '+not_current_year+'">' + y + "</span>";
}
Nice, thanks for your contribution!
Released as 3.2.0
This change will allow the date parts to be styled individually using the same CSS suffix as the character used in the
title_format
option. For example:Will produce a title like:
https://imgur.com/a/ZgGnWkk
The only caveat is that CSS class selectors are case-insensitive, so
.pickmeup .pmu-month-text-B
will also match the same as.pickmeup .pmu-month-text-b
, etc.I hope you like it.