Created
July 13, 2015 20:47
-
-
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+
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(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