Sep 26 2015 0

Final change for calendar badge

I had been in contact with David on the possibility on getting some additional variables available for manipulating dates. This was induced by my tinkering with the look-n-feel for my blog and specifically to design and coding of the calendar badges.

Instead of just adding some variables David implemented formatting options by applying Moments, a library/toolkit specifically developed to Parse, validate, manipulate, and display dates in JavaScript’.

The templates entry.html and entries.html are now using the following code

<div class="calendar">
    <span class="month">{{#formatDate}}MMM{{/formatDate}}</span>
    <span class="day">{{#formatDate}}D{{/formatDate}}</span>
    <span class="year">{{#formatDate}}YYYY{{/formatDate}}</span>
</div>

instead of the old template that required additional jQuery code

<div class="calendar" data="{{date}}">
    <span class="month"> </span>
    <span class="day"> </span>
    <span class="year"> </span>
</div>

For the template archives.html the code has been update to this

<span class="archive">{{#formatDate}}DD{{/formatDate}}:</span> <a class="archive" href="{{url}}">{{title}}</a><br />

which was the following in the previous version (and also required additional jQuery code)

<span class="archive" data={{date}}>--:</span> <a class="archive" href="{{url}}">{{title}}</a><br />

Within scripts.js all the blocks of code related to the calendar badge archives page have been removed.

Latest (full) versions of these files can be found on GitHub

David, thank you very much for implementing this feature!


Previous post
Fixing the Archives page In my previous post I fixed the calendar badge to make it work for image-only posts as well. The same issue could also be found in
Next post
Blood Moon / Total Lunar Eclipse The moon on September 28 @ 2:42 am (f/5.6, exposure time 1/4 seconds) The moon on September 28 @ 4:29 am (f/5.6, exposure time 18 seconds). Sadly
This blog is powered by Blot