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_short: "mmm d",
full: "mmmm d',' yyyy", full: "mmmm d',' yyyy",
time_no_seconds_short: "h:MM TT", time_no_seconds_short: "h:MM TT",
time_no_seconds_small_date: "dddd', 'h:MM TT'<br/><small>'mmmm d',' yyyy'</small>'", time_no_seconds_small_date: "'h:MM TT'<br/><small>'mmmm d',' yyyy'</small>'",
full_long: "dddd',' mmm d',' yyyy 'at' hh:MM TT", full_long: "mmm d',' yyyy 'at' hh:MM TT",
full_long_small_date: "hh:MM TT'<br/><small>'dddd',' mmm d',' yyyy'</small>'", full_long_small_date: "hh:MM TT'<br/><small>mmm d',' yyyy'</small>'",
}, },
messages: { messages: {
loading_timeline: "Loading Timeline... ", 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); VMM.ExternalAPI.googledocs.get(m.id, googledocs_id);
// YOUTUBE // YOUTUBE
} else if (m.type == "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); VMM.ExternalAPI.youtube.get(m.id);
// VIMEO // VIMEO
} else if (m.type == "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 st = VMM.Util.date.prettyDate(data.startdate);
var en = VMM.Util.date.prettyDate(data.enddate); var en = VMM.Util.date.prettyDate(data.enddate);
if (st != en) { if (st != en) {
//st = VMM.Util.date.prettyDate(data.startdate, true); c.text += VMM.createElement("h2", st + " &mdash; " + en + "", "date");
//en = VMM.Util.date.prettyDate(data.enddate, true);
c.text += VMM.createElement("h2", st + "<small> &mdash; " + en + "</small>", "date");
} else { } else {
c.text += VMM.createElement("h2", st, "date"); 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); _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; inc_time = 1;

106
source/js/VMM.Util.js

@ -106,6 +106,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Util == 'undefined') {
}, },
date: { date: {
dateformats: { dateformats: {
year: "yyyy", year: "yyyy",
month_short: "mmm", month_short: "mmm",
@ -113,10 +114,11 @@ if(typeof VMM != 'undefined' && typeof VMM.Util == 'undefined') {
full_short: "mmm d", full_short: "mmm d",
full: "mmmm d',' yyyy", full: "mmmm d',' yyyy",
time_no_seconds_short: "h:MM TT", time_no_seconds_short: "h:MM TT",
time_no_seconds_small_date: "dddd', 'h:MM TT'<br/><small>'mmmm d',' yyyy'</small>'", time_no_seconds_small_date: "'h:MM TT'<br/><small>'mmmm d',' yyyy'</small>'",
full_long: "dddd',' mmm d',' yyyy 'at' hh:MM TT", full_long: "mmm d',' yyyy 'at' hh:MM TT",
full_long_small_date: "hh:MM TT'<br/><small>'dddd',' mmm d',' yyyy'</small>'", 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: ["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."], month_abbr: ["Jan.", "Feb.", "March", "April", "May", "June", "July", "Aug.", "Sept.", "Oct.", "Nov.", "Dec."],
day: ["Sunday","Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], 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, d2) {
prettyDate: function(d, is_abbr, date_type) {
var _date; var _date;
var _date2;
var format;
var bc_check; var bc_check;
var is_pair = false;
if (d2 != null) {
is_pair = true;
}
if (type.of(d) == "date") { if (type.of(d) == "date") {
if (d.getMonth() === 0 && d.getDate() == 1 && d.getHours() === 0 && d.getMinutes() === 0 ) { if (d.getMonth() === 0 && d.getDate() == 1 && d.getHours() === 0 && d.getMinutes() === 0 ) {
// trace("YEAR ONLY"); // YEAR ONLY
_date = dateFormat(d, VMM.Util.date.dateformats.year); 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 { } else {
if (d.getDate() <= 1 && d.getHours() === 0 && d.getMinutes() === 0) { // YEAR MONTH DAY HOUR MINUTE
// trace("YEAR MONTH"); if (is_abbr){
if (is_abbr) { format = VMM.Util.date.dateformats.time_no_seconds_short;
_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 );
}
} else { } else {
// trace("YEAR MONTH DAY HOUR MINUTE"); format = VMM.Util.date.dateformats.full_long;
if (is_abbr){
_date = dateFormat(d, VMM.Util.date.dateformats.time_no_seconds_short);
} else {
_date = dateFormat(d, VMM.Util.date.dateformats.full_long);
}
} }
} }
_date = dateFormat(d, format);
bc_check = _date.split(" "); bc_check = _date.split(" ");
// BC TIME SUPPORT
for(var i = 0; i < bc_check.length; i++) { for(var i = 0; i < bc_check.length; i++) {
if ( parseInt(bc_check[i]) < 0 ) { if ( parseInt(bc_check[i]) < 0 ) {
trace("YEAR IS BC"); trace("YEAR IS BC");
var bc_original = bc_check[i]; var bc_original = bc_check[i];
var bc_number = Math.abs( parseInt(bc_check[i]) ); var bc_number = Math.abs( parseInt(bc_check[i]) );
var bc_string = bc_number.toString() + " B.C."; var bc_string = bc_number.toString() + " B.C.";
_date = _date.replace(bc_original, bc_string); _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 { } else {
trace("NOT A VALID DATE?"); trace("NOT A VALID DATE?");
trace(d); trace(d);
} }
if (is_pair) {
return _date; 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_short: "mmm d",
full: "mmmm d',' yyyy", full: "mmmm d',' yyyy",
time_no_seconds_short: "h:MM TT", time_no_seconds_short: "h:MM TT",
time_no_seconds_small_date: "dddd', 'h:MM TT'<br/><small>'mmmm d',' yyyy'</small>'", time_no_seconds_small_date: "'h:MM TT'<br/><small>'mmmm d',' yyyy'</small>'",
full_long: "dddd',' mmm d',' yyyy 'at' hh:MM TT", full_long: "mmm d',' yyyy 'at' hh:MM TT",
full_long_small_date: "hh:MM TT'<br/><small>'dddd',' mmm d',' yyyy'</small>'", full_long_small_date: "hh:MM TT'<br/><small>mmm d',' yyyy'</small>'",
}, },
messages: { messages: {
loading_timeline: "Loading Timeline... ", 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); VMM.ExternalAPI.googledocs.get(m.id, googledocs_id);
// YOUTUBE // YOUTUBE
} else if (m.type == "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); VMM.ExternalAPI.youtube.get(m.id);
// VIMEO // VIMEO
} else if (m.type == "vimeo") { } else if (m.type == "vimeo") {
@ -3891,9 +3891,7 @@ if (typeof VMM.Slider != 'undefined') {
var st = VMM.Util.date.prettyDate(data.startdate); var st = VMM.Util.date.prettyDate(data.startdate);
var en = VMM.Util.date.prettyDate(data.enddate); var en = VMM.Util.date.prettyDate(data.enddate);
if (st != en) { if (st != en) {
//st = VMM.Util.date.prettyDate(data.startdate, true); c.text += VMM.createElement("h2", st + " &mdash; " + en + "", "date");
//en = VMM.Util.date.prettyDate(data.enddate, true);
c.text += VMM.createElement("h2", st + "<small> &mdash; " + en + "</small>", "date");
} else { } else {
c.text += VMM.createElement("h2", st, "date"); c.text += VMM.createElement("h2", st, "date");
} }
@ -4065,6 +4063,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Util == 'undefined') {
}, },
date: { date: {
dateformats: { dateformats: {
year: "yyyy", year: "yyyy",
month_short: "mmm", month_short: "mmm",
@ -4072,10 +4071,11 @@ if(typeof VMM != 'undefined' && typeof VMM.Util == 'undefined') {
full_short: "mmm d", full_short: "mmm d",
full: "mmmm d',' yyyy", full: "mmmm d',' yyyy",
time_no_seconds_short: "h:MM TT", time_no_seconds_short: "h:MM TT",
time_no_seconds_small_date: "dddd', 'h:MM TT'<br/><small>'mmmm d',' yyyy'</small>'", time_no_seconds_small_date: "'h:MM TT'<br/><small>'mmmm d',' yyyy'</small>'",
full_long: "dddd',' mmm d',' yyyy 'at' hh:MM TT", full_long: "mmm d',' yyyy 'at' hh:MM TT",
full_long_small_date: "hh:MM TT'<br/><small>'dddd',' mmm d',' yyyy'</small>'", 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: ["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."], month_abbr: ["Jan.", "Feb.", "March", "April", "May", "June", "July", "Aug.", "Sept.", "Oct.", "Nov.", "Dec."],
day: ["Sunday","Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], 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, d2) {
prettyDate: function(d, is_abbr, date_type) {
var _date; var _date;
var _date2;
var format;
var bc_check; var bc_check;
var is_pair = false;
if (d2 != null) {
is_pair = true;
}
if (type.of(d) == "date") { if (type.of(d) == "date") {
if (d.getMonth() === 0 && d.getDate() == 1 && d.getHours() === 0 && d.getMinutes() === 0 ) { if (d.getMonth() === 0 && d.getDate() == 1 && d.getHours() === 0 && d.getMinutes() === 0 ) {
// trace("YEAR ONLY"); // YEAR ONLY
_date = dateFormat(d, VMM.Util.date.dateformats.year); 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 { } else {
if (d.getDate() <= 1 && d.getHours() === 0 && d.getMinutes() === 0) { // YEAR MONTH DAY HOUR MINUTE
// trace("YEAR MONTH"); if (is_abbr){
if (is_abbr) { format = VMM.Util.date.dateformats.time_no_seconds_short;
_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 );
}
} else { } else {
// trace("YEAR MONTH DAY HOUR MINUTE"); format = VMM.Util.date.dateformats.full_long;
if (is_abbr){
_date = dateFormat(d, VMM.Util.date.dateformats.time_no_seconds_short);
} else {
_date = dateFormat(d, VMM.Util.date.dateformats.full_long);
}
} }
} }
_date = dateFormat(d, format);
bc_check = _date.split(" "); bc_check = _date.split(" ");
// BC TIME SUPPORT
for(var i = 0; i < bc_check.length; i++) { for(var i = 0; i < bc_check.length; i++) {
if ( parseInt(bc_check[i]) < 0 ) { if ( parseInt(bc_check[i]) < 0 ) {
trace("YEAR IS BC"); trace("YEAR IS BC");
var bc_original = bc_check[i]; var bc_original = bc_check[i];
var bc_number = Math.abs( parseInt(bc_check[i]) ); var bc_number = Math.abs( parseInt(bc_check[i]) );
var bc_string = bc_number.toString() + " B.C."; var bc_string = bc_number.toString() + " B.C.";
_date = _date.replace(bc_original, bc_string); _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 { } else {
trace("NOT A VALID DATE?"); trace("NOT A VALID DATE?");
trace(d); trace(d);
} }
if (is_pair) {
return _date; return _date + " &mdash; " + _date2;
}, } else {
return _date;
}
}
}, },
@ -4953,9 +4973,9 @@ if(typeof VMM != 'undefined' && typeof VMM.Language == 'undefined') {
full_short: "mmm d", full_short: "mmm d",
full: "mmmm d',' yyyy", full: "mmmm d',' yyyy",
time_no_seconds_short: "h:MM TT", time_no_seconds_short: "h:MM TT",
time_no_seconds_small_date: "dddd', 'h:MM TT'<br/><small>'mmmm d',' yyyy'</small>'", time_no_seconds_small_date: "'h:MM TT'<br/><small>'mmmm d',' yyyy'</small>'",
full_long: "dddd',' mmm d',' yyyy 'at' hh:MM TT", full_long: "mmm d',' yyyy 'at' hh:MM TT",
full_long_small_date: "hh:MM TT'<br/><small>'dddd',' mmm d',' yyyy'</small>'", full_long_small_date: "hh:MM TT'<br/><small>mmm d',' yyyy'</small>'",
}, },
messages: { messages: {
loading_timeline: "Loading Timeline... ", 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); _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; inc_time = 1;

Loading…
Cancel
Save