Skip to content

Instantly share code, notes, and snippets.

@bappi-d-great
Created July 13, 2015 20:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bappi-d-great/e3fe254aed7214cc2ce0 to your computer and use it in GitHub Desktop.
Save bappi-d-great/e3fe254aed7214cc2ce0 to your computer and use it in GitHub Desktop.
Updated local timezone js file to change the event date and time format - E+
;(function ($, undefined) {
$(function () {
var locale = $("html").attr("lang");
$("time[datetime]").each(function () {
var $time = $(this),
$parent = $time.closest(".wpmudevevents-date, .eab-has_events"),
datetime = $time.attr("datetime"),
$dts = $time.find((
$parent.is(".eab-has_events")
? "var.eab-date_format-time,var.eab-date_format-date" // Table dates
: "var.eab-date_format-time:visible,var.eab-date_format-date:visible" // Regular dates
))
;
if (!$time.length || !datetime || !$dts.length) return true;
var date = new Date(Date.parse(datetime));
if (isNaN(date)) return false;
$dts.each(function () {
var $me = $(this),
old = $me.text()
;
var options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
$me
.text((
$me.is(".eab-date_format-time")
? date.toLocaleTimeString(locale, {hour: '2-digit', minute:'2-digit'})
: date.toLocaleDateString(locale, options)
))
.attr("title", old)
;
});
});
});
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment