Browse Source

Cleanup date formatting for start and end dates

pull/79/head
Zach Wise 13 years ago
parent
commit
e501f2ba26
  1. 8
      locale/de.js
  2. 8
      locale/en.js
  3. 8
      locale/es.js
  4. 8
      locale/fr.js
  5. 8
      locale/is.js
  6. 8
      locale/it.js
  7. 8
      locale/kr.js
  8. 8
      locale/nl.js
  9. 8
      locale/pt-br.js
  10. 8
      locale/zh-ch.js
  11. 8
      locale/zh-tw.js
  12. 6
      source/js/VMM.Language.js
  13. 2
      source/js/VMM.MediaElement.js
  14. 4
      source/js/VMM.Slider.Slide.js
  15. 2
      source/js/VMM.Timeline.TimeNav.js
  16. 106
      source/js/VMM.Util.js
  17. 6
      source/js/locale/en.js
  18. 8
      timeline-min.js
  19. 120
      timeline.js

8
locale/de.js

File diff suppressed because one or more lines are too long

8
locale/en.js

File diff suppressed because one or more lines are too long

8
locale/es.js

File diff suppressed because one or more lines are too long

8
locale/fr.js

File diff suppressed because one or more lines are too long

8
locale/is.js

File diff suppressed because one or more lines are too long

8
locale/it.js

File diff suppressed because one or more lines are too long

8
locale/kr.js

File diff suppressed because one or more lines are too long

8
locale/nl.js

File diff suppressed because one or more lines are too long

8
locale/pt-br.js

File diff suppressed because one or more lines are too long

8
locale/zh-ch.js

File diff suppressed because one or more lines are too long

8
locale/zh-tw.js

File diff suppressed because one or more lines are too long

6
source/js/VMM.Language.js

@ -15,9 +15,9 @@ if(typeof VMM != 'undefined' && typeof VMM.Language == 'undefined') {
full_short: "mmm d",
full: "mmmm d',' yyyy",
time_no_seconds_short: "h:MM TT",
time_no_seconds_small_date: "dddd', 'h:MM TT'<br/><small>'mmmm d',' yyyy'</small>'",
full_long: "dddd',' mmm d',' yyyy 'at' hh:MM TT",
full_long_small_date: "hh:MM TT'<br/><small>'dddd',' mmm d',' yyyy'</small>'",
time_no_seconds_small_date: "'h: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... ",

2
source/js/VMM.MediaElement.js

@ -97,7 +97,7 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaElement == 'undefined') {
VMM.ExternalAPI.googledocs.get(m.id, googledocs_id);
// YOUTUBE
} else if (m.type == "youtube") {
mediaElem = "<div class='media-frame video youtube' id='youtube_" + m.id + "'>Loading YouTube video...</div>";
mediaElem = "<div class='media-frame video youtube' id='youtube_" + m.id + "'><span class='messege'>Loading YouTube video</span></div>";
VMM.ExternalAPI.youtube.get(m.id);
// VIMEO
} else if (m.type == "vimeo") {

4
source/js/VMM.Slider.Slide.js

@ -87,9 +87,7 @@ if (typeof VMM.Slider != 'undefined') {
var st = VMM.Util.date.prettyDate(data.startdate);
var en = VMM.Util.date.prettyDate(data.enddate);
if (st != en) {
//st = VMM.Util.date.prettyDate(data.startdate, true);
//en = VMM.Util.date.prettyDate(data.enddate, true);
c.text += VMM.createElement("h2", st + "<small> &mdash; " + en + "</small>", "date");
c.text += VMM.createElement("h2", st + " &mdash; " + en + "", "date");
} else {
c.text += VMM.createElement("h2", st, "date");
}

2
source/js/VMM.Timeline.TimeNav.js

@ -840,7 +840,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
_interval.date.setSeconds(_interval.date.getSeconds() + inc_time);
}
_idd = VMM.Util.date.prettyDate(_interval.date, true, _interval.type);
_idd = VMM.Util.date.prettyDate(_interval.date, true);
inc_time = 1;

106
source/js/VMM.Util.js

@ -106,6 +106,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Util == 'undefined') {
},
date: {
dateformats: {
year: "yyyy",
month_short: "mmm",
@ -113,10 +114,11 @@ if(typeof VMM != 'undefined' && typeof VMM.Util == 'undefined') {
full_short: "mmm d",
full: "mmmm d',' yyyy",
time_no_seconds_short: "h:MM TT",
time_no_seconds_small_date: "dddd', 'h:MM TT'<br/><small>'mmmm d',' yyyy'</small>'",
full_long: "dddd',' mmm d',' yyyy 'at' hh:MM TT",
full_long_small_date: "hh:MM TT'<br/><small>'dddd',' mmm d',' yyyy'</small>'",
time_no_seconds_small_date: "'h: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>'",
},
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"],
@ -207,72 +209,92 @@ if(typeof VMM != 'undefined' && typeof VMM.Util == 'undefined') {
}
},
//VMM.Util.date.prettyDate(d, is_abbr)
prettyDate: function(d, is_abbr, date_type) {
prettyDate: function(d, is_abbr, d2) {
var _date;
var _date2;
var format;
var bc_check;
var is_pair = false;
if (d2 != null) {
is_pair = true;
}
if (type.of(d) == "date") {
if (d.getMonth() === 0 && d.getDate() == 1 && d.getHours() === 0 && d.getMinutes() === 0 ) {
// trace("YEAR ONLY");
_date = dateFormat(d, VMM.Util.date.dateformats.year);
// YEAR ONLY
format = VMM.Util.date.dateformats.year;
} else if (d.getDate() <= 1 && d.getHours() === 0 && d.getMinutes() === 0) {
// YEAR MONTH
if (is_abbr) {
format = VMM.Util.date.dateformats.month_short;
} else {
format = VMM.Util.date.dateformats.month;
}
} else if (d.getHours() === 0 && d.getMinutes() === 0) {
// YEAR MONTH DAY
if (is_abbr) {
format = VMM.Util.date.dateformats.full_short;
} else {
format = VMM.Util.date.dateformats.full;
}
} else if (d.getMinutes() === 0) {
// YEAR MONTH DAY HOUR
if (is_abbr) {
format = VMM.Util.date.dateformats.time_no_seconds_short;
} else {
format = VMM.Util.date.dateformats.time_no_seconds_small_date;
}
} else {
if (d.getDate() <= 1 && d.getHours() === 0 && d.getMinutes() === 0) {
// trace("YEAR MONTH");
if (is_abbr) {
_date = dateFormat(d, VMM.Util.date.dateformats.month_short );
} else {
_date = dateFormat(d, VMM.Util.date.dateformats.month);
}
} else if (d.getHours() === 0 && d.getMinutes() === 0) {
// trace("YEAR MONTH DAY");
if (is_abbr) {
_date = dateFormat(d, VMM.Util.date.dateformats.full_short);
} else {
_date = dateFormat(d, VMM.Util.date.dateformats.full);
}
} else if (d.getMinutes() === 0) {
// trace("YEAR MONTH DAY HOUR");
if (is_abbr) {
_date = dateFormat(d, VMM.Util.date.dateformats.time_no_seconds_short);
} else {
_date = dateFormat(d, VMM.Util.date.dateformats.time_no_seconds_small_date );
}
// YEAR MONTH DAY HOUR MINUTE
if (is_abbr){
format = VMM.Util.date.dateformats.time_no_seconds_short;
} else {
// trace("YEAR MONTH DAY HOUR MINUTE");
if (is_abbr){
_date = dateFormat(d, VMM.Util.date.dateformats.time_no_seconds_short);
} else {
_date = dateFormat(d, VMM.Util.date.dateformats.full_long);
}
format = VMM.Util.date.dateformats.full_long;
}
}
_date = dateFormat(d, format);
bc_check = _date.split(" ");
// BC TIME SUPPORT
for(var i = 0; i < bc_check.length; i++) {
if ( parseInt(bc_check[i]) < 0 ) {
trace("YEAR IS BC");
var bc_original = bc_check[i];
var bc_number = Math.abs( parseInt(bc_check[i]) );
var bc_string = bc_number.toString() + " B.C.";
_date = _date.replace(bc_original, bc_string);
}
}
if (is_pair) {
_date2 = dateFormat(d2, format);
bc_check = _date2.split(" ");
// BC TIME SUPPORT
for(var i = 0; i < bc_check.length; i++) {
if ( parseInt(bc_check[i]) < 0 ) {
trace("YEAR IS BC");
var bc_original = bc_check[i];
var bc_number = Math.abs( parseInt(bc_check[i]) );
var bc_string = bc_number.toString() + " B.C.";
_date2 = _date2.replace(bc_original, bc_string);
}
}
}
} else {
trace("NOT A VALID DATE?");
trace(d);
}
return _date;
},
if (is_pair) {
return _date + " &mdash; " + _date2;
} else {
return _date;
}
}
},

6
source/js/locale/en.js

@ -17,9 +17,9 @@ if(typeof VMM != 'undefined') {
full_short: "mmm d",
full: "mmmm d',' yyyy",
time_no_seconds_short: "h:MM TT",
time_no_seconds_small_date: "dddd', 'h:MM TT'<br/><small>'mmmm d',' yyyy'</small>'",
full_long: "dddd',' mmm d',' yyyy 'at' hh:MM TT",
full_long_small_date: "hh:MM TT'<br/><small>'dddd',' mmm d',' yyyy'</small>'",
time_no_seconds_small_date: "'h: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... ",

8
timeline-min.js vendored

File diff suppressed because one or more lines are too long

120
timeline.js

@ -1821,7 +1821,7 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaElement == 'undefined') {
VMM.ExternalAPI.googledocs.get(m.id, googledocs_id);
// YOUTUBE
} else if (m.type == "youtube") {
mediaElem = "<div class='media-frame video youtube' id='youtube_" + m.id + "'>Loading YouTube video...</div>";
mediaElem = "<div class='media-frame video youtube' id='youtube_" + m.id + "'><span class='messege'>Loading YouTube video</span></div>";
VMM.ExternalAPI.youtube.get(m.id);
// VIMEO
} else if (m.type == "vimeo") {
@ -3891,9 +3891,7 @@ if (typeof VMM.Slider != 'undefined') {
var st = VMM.Util.date.prettyDate(data.startdate);
var en = VMM.Util.date.prettyDate(data.enddate);
if (st != en) {
//st = VMM.Util.date.prettyDate(data.startdate, true);
//en = VMM.Util.date.prettyDate(data.enddate, true);
c.text += VMM.createElement("h2", st + "<small> &mdash; " + en + "</small>", "date");
c.text += VMM.createElement("h2", st + " &mdash; " + en + "", "date");
} else {
c.text += VMM.createElement("h2", st, "date");
}
@ -4065,6 +4063,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Util == 'undefined') {
},
date: {
dateformats: {
year: "yyyy",
month_short: "mmm",
@ -4072,10 +4071,11 @@ if(typeof VMM != 'undefined' && typeof VMM.Util == 'undefined') {
full_short: "mmm d",
full: "mmmm d',' yyyy",
time_no_seconds_short: "h:MM TT",
time_no_seconds_small_date: "dddd', 'h:MM TT'<br/><small>'mmmm d',' yyyy'</small>'",
full_long: "dddd',' mmm d',' yyyy 'at' hh:MM TT",
full_long_small_date: "hh:MM TT'<br/><small>'dddd',' mmm d',' yyyy'</small>'",
time_no_seconds_small_date: "'h: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>'",
},
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"],
@ -4166,72 +4166,92 @@ if(typeof VMM != 'undefined' && typeof VMM.Util == 'undefined') {
}
},
//VMM.Util.date.prettyDate(d, is_abbr)
prettyDate: function(d, is_abbr, date_type) {
prettyDate: function(d, is_abbr, d2) {
var _date;
var _date2;
var format;
var bc_check;
var is_pair = false;
if (d2 != null) {
is_pair = true;
}
if (type.of(d) == "date") {
if (d.getMonth() === 0 && d.getDate() == 1 && d.getHours() === 0 && d.getMinutes() === 0 ) {
// trace("YEAR ONLY");
_date = dateFormat(d, VMM.Util.date.dateformats.year);
// YEAR ONLY
format = VMM.Util.date.dateformats.year;
} else if (d.getDate() <= 1 && d.getHours() === 0 && d.getMinutes() === 0) {
// YEAR MONTH
if (is_abbr) {
format = VMM.Util.date.dateformats.month_short;
} else {
format = VMM.Util.date.dateformats.month;
}
} else if (d.getHours() === 0 && d.getMinutes() === 0) {
// YEAR MONTH DAY
if (is_abbr) {
format = VMM.Util.date.dateformats.full_short;
} else {
format = VMM.Util.date.dateformats.full;
}
} else if (d.getMinutes() === 0) {
// YEAR MONTH DAY HOUR
if (is_abbr) {
format = VMM.Util.date.dateformats.time_no_seconds_short;
} else {
format = VMM.Util.date.dateformats.time_no_seconds_small_date;
}
} else {
if (d.getDate() <= 1 && d.getHours() === 0 && d.getMinutes() === 0) {
// trace("YEAR MONTH");
if (is_abbr) {
_date = dateFormat(d, VMM.Util.date.dateformats.month_short );
} else {
_date = dateFormat(d, VMM.Util.date.dateformats.month);
}
} else if (d.getHours() === 0 && d.getMinutes() === 0) {
// trace("YEAR MONTH DAY");
if (is_abbr) {
_date = dateFormat(d, VMM.Util.date.dateformats.full_short);
} else {
_date = dateFormat(d, VMM.Util.date.dateformats.full);
}
} else if (d.getMinutes() === 0) {
// trace("YEAR MONTH DAY HOUR");
if (is_abbr) {
_date = dateFormat(d, VMM.Util.date.dateformats.time_no_seconds_short);
} else {
_date = dateFormat(d, VMM.Util.date.dateformats.time_no_seconds_small_date );
}
// YEAR MONTH DAY HOUR MINUTE
if (is_abbr){
format = VMM.Util.date.dateformats.time_no_seconds_short;
} else {
// trace("YEAR MONTH DAY HOUR MINUTE");
if (is_abbr){
_date = dateFormat(d, VMM.Util.date.dateformats.time_no_seconds_short);
} else {
_date = dateFormat(d, VMM.Util.date.dateformats.full_long);
}
format = VMM.Util.date.dateformats.full_long;
}
}
_date = dateFormat(d, format);
bc_check = _date.split(" ");
// BC TIME SUPPORT
for(var i = 0; i < bc_check.length; i++) {
if ( parseInt(bc_check[i]) < 0 ) {
trace("YEAR IS BC");
var bc_original = bc_check[i];
var bc_number = Math.abs( parseInt(bc_check[i]) );
var bc_string = bc_number.toString() + " B.C.";
_date = _date.replace(bc_original, bc_string);
}
}
if (is_pair) {
_date2 = dateFormat(d2, format);
bc_check = _date2.split(" ");
// BC TIME SUPPORT
for(var i = 0; i < bc_check.length; i++) {
if ( parseInt(bc_check[i]) < 0 ) {
trace("YEAR IS BC");
var bc_original = bc_check[i];
var bc_number = Math.abs( parseInt(bc_check[i]) );
var bc_string = bc_number.toString() + " B.C.";
_date2 = _date2.replace(bc_original, bc_string);
}
}
}
} else {
trace("NOT A VALID DATE?");
trace(d);
}
return _date;
},
if (is_pair) {
return _date + " &mdash; " + _date2;
} else {
return _date;
}
}
},
@ -4953,9 +4973,9 @@ if(typeof VMM != 'undefined' && typeof VMM.Language == 'undefined') {
full_short: "mmm d",
full: "mmmm d',' yyyy",
time_no_seconds_short: "h:MM TT",
time_no_seconds_small_date: "dddd', 'h:MM TT'<br/><small>'mmmm d',' yyyy'</small>'",
full_long: "dddd',' mmm d',' yyyy 'at' hh:MM TT",
full_long_small_date: "hh:MM TT'<br/><small>'dddd',' mmm d',' yyyy'</small>'",
time_no_seconds_small_date: "'h: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... ",
@ -6326,7 +6346,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
_interval.date.setSeconds(_interval.date.getSeconds() + inc_time);
}
_idd = VMM.Util.date.prettyDate(_interval.date, true, _interval.type);
_idd = VMM.Util.date.prettyDate(_interval.date, true);
inc_time = 1;

Loading…
Cancel
Save