Skip to content

Commit

Permalink
fixing large.html
Browse files Browse the repository at this point in the history
  • Loading branch information
timeglider committed Sep 10, 2012
2 parents 6587ce0 + b9e9ab1 commit 0dd24ba
Show file tree
Hide file tree
Showing 162 changed files with 2,637 additions and 3,135 deletions.
38 changes: 29 additions & 9 deletions js/timeglider/TG_Date.js
Expand Up @@ -11,7 +11,7 @@
// initial declaration of timeglider object for widget
// authoring app will declare a different object, so
// this will defer to window.timeglider
timeglider = window.timeglider || {version:"0.1.0"};
timeglider = window.timeglider || {mode:"publish", version:"0.1.0"};



Expand Down Expand Up @@ -674,11 +674,23 @@ timeglider.TG_Date = {};

if (this.ye > -270000){

fromUTC = TG_Date.toFromUTC(_.clone(this), offset, "from");

jsDate = new Date(fromUTC.ye, (fromUTC.mo-1), fromUTC.da, fromUTC.ho, fromUTC.mi, fromUTC.se, 0);

return $.global.format(jsDate, sig);
var cloner = _.clone(this);
fromUTC = TG_Date.toFromUTC(cloner, offset, "from");

var utcy = Number(fromUTC.ye);

if (utcy > 0 && utcy < 100) {
utcy = "0" + utcy;
// we can use the same thing we use for the BIGNUM problem
// below for this weird window that JS fails on
return TG_Date.monthNamesAbbr[fromUTC.mo] + " " + fromUTC.da + ", " + fromUTC.ye;

} else {
jsDate = new Date(utcy, (fromUTC.mo-1), fromUTC.da, fromUTC.ho, fromUTC.mi, fromUTC.se, 0);

return $.global.format(jsDate, sig);
}



} else {
Expand Down Expand Up @@ -816,11 +828,15 @@ timeglider.TG_Date = {};
* @return {Object} date, time as strings with am or pm
*/
TG_Date.getDateTimeStrings = function (str) {

var obj = TG_Date.parse8601(str);

// DATE IS EASY:
var date_val = obj.ye + "-" + unboil(obj.mo) + "-" + unboil(obj.da);
if (str == "today") {
return {"date": "today", "time":""}
} else {
var date_val = obj.ye + "-" + unboil(obj.mo) + "-" + unboil(obj.da);
}


var ampm = "pm";

Expand All @@ -842,6 +858,10 @@ timeglider.TG_Date = {};
// field needs to be restricted by the $.alphanumeric plugin
TG_Date.transValidateDateString = function (date_str) {

if (date_str == "today"){
return "today";
}

if (!date_str) return false; // date needs some value
var reg = /^(\-?\d+|today|now) ?(bce?)?-?(\d{1,2})?-?(\d{1,2})?/,
valid = "",
Expand Down

0 comments on commit 0dd24ba

Please sign in to comment.