Browse Source

support 'W' as a date format token

pull/639/head
Joe Germuska 11 years ago
parent
commit
1ace338171
  1. 6
      source/js/Core/Core/VMM.Date.js
  2. 37
      source/js/Core/Language/locale/en-week.js

6
source/js/Core/Core/VMM.Date.js

@ -451,7 +451,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Date == 'undefined') {
*/
var dateFormat = function () {
var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,
var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[WLloSZ]|"[^"]*"|'[^']*'/g,
timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
timezoneClip = /[^-+\dA-Z]/g,
pad = function (val, len) {
@ -496,6 +496,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Date == 'undefined') {
M = date[_ + "Minutes"](),
s = date[_ + "Seconds"](),
L = date[_ + "Milliseconds"](),
W = date.getWeek(),
o = utc ? 0 : date.getTimezoneOffset(),
flags = {
d: d,
@ -524,7 +525,8 @@ if(typeof VMM != 'undefined' && typeof VMM.Date == 'undefined') {
TT: H < 12 ? "AM" : "PM",
Z: utc ? "UTC" : (String(date).match(timezone) || [""]).pop().replace(timezoneClip, ""),
o: (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
S: ["th", "st", "nd", "rd"][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10]
S: ["th", "st", "nd", "rd"][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10],
W: W
};
return mask.replace(token, function ($0) {

37
source/js/Core/Language/locale/en-week.js

@ -0,0 +1,37 @@
/* English LANGUAGE
================================================== */
if(typeof VMM != 'undefined') {
VMM.Language = {
lang: "en",
api: {
wikipedia: "en"
},
date: {
month: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
month_abbr: ["Jan.", "Feb.", "March", "April", "May", "June", "July", "Aug.", "Sept.", "Oct.", "Nov.", "Dec."],
day: ["Sunday","Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
day_abbr: ["Sun.","Mon.", "Tues.", "Wed.", "Thurs.", "Fri.", "Sat."]
},
dateformats: {
year: "yyyy",
month_short: "mmm",
month: "mmmm yyyy",
full_short: "'Week' W",
full: "'Week' W",
time_short: "HH:MM:ss",
time_no_seconds_short: "HH:MM TT",
time_no_seconds_small_date: "HH:MM TT'<br/><small>'mmmm d',' yyyy'</small>'",
full_long: "mmm d',' yyyy 'at' HH:MM TT",
full_long_small_date: "HH:MM TT'<br/><small>mmm d',' yyyy'</small>'"
},
messages: {
loading_timeline: "Loading Timeline... ",
return_to_title: "Return to Title",
expand_timeline: "Expand Timeline",
contract_timeline: "Contract Timeline",
wikipedia: "From Wikipedia, the free encyclopedia",
loading_content: "Loading Content",
loading: "Loading"
}
}
}
Loading…
Cancel
Save