Example #1
0
var krtime = function(time){
	if(time.indexOf('일') != -1){
		return strptime(String(time), '%Y년 %m월 %d일')
	}else if(time.indexOf('월') != -1){
		return strptime(String(time), '%Y년 %m월')
	}else if(time.indexOf('년') != -1){
		return strptime(String(time), '%Y년')
	}else{
		return;
	}
}
Example #2
0
 self.do_request("getpredictions", { rt: rt, dir: dir + " Bound", stpid: stpid }, "prd", function(prd) {
     var prdtm = strptime(""+prd.prdtm, '%Y%m%d %H:%M');
     var minutes = Math.floor( (prdtm.valueOf() - now.valueOf()) / 60000 );
     if (cb) {
         cb(minutes);
     } else {
         console.log("There will be a bus arriving in " + minutes + " minute" + (minutes==1 ? "":"s") + ".");
     }
 }, function(err) {
Example #3
0
export function formatTime(raw, parse_format="%H:%M:%S", to_format) {
  if (typeof raw === "string") {
    let time = strptime(raw, parse_format);
    if (!to_format) {
      return time;
    } else {
      return strftime(to_format, time);
    }
  } else {
    return null;
  }
}
Example #4
0
BusTracker.prototype.parse_time = function(tstr) {
    return strptime(""+tstr, '%Y%m%d %H:%M:%S');
};