From 3d3e4d753c62010b4bea61dabc9f1a92f8438377 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 11 May 2012 17:52:22 +0530 Subject: [PATCH] fix in posting time issue --- js/all-app.js | 4 ++-- js/all-web.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/js/all-app.js b/js/all-app.js index 5d3e0eb064..ddbbc48978 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -612,11 +612,11 @@ return(hh.length==1?'0'+hh:hh)+':'+(mm.length==1?'0'+mm:mm);}} wn.datetime.only_date=function(val){if(val==null||val=='')return null;if(val.search(':')!=-1){var tmp=val.split(' ');var d=tmp[0].split('-');}else{var d=val.split('-');} if(d.length==3) val=d[2]+'-'+d[1]+'-'+d[0];return val;} -wn.datetime.time_to_ampm=function(v){if(!v){var d=new Date();var t=[d.getHours(),cint(d.getMinutes()/5)*5]}else{var t=v.split(':');} +wn.datetime.time_to_ampm=function(v){if(!v){var d=new Date();var t=[d.getHours(),cint(d.getMinutes()/5)*5+'']}else{var t=v.split(':');} if(t.length!=2){show_alert('[set_time] Incorect time format');return;} if(cint(t[0])==0)var ret=['12',t[1],'AM'];else if(cint(t[0])<12)var ret=[cint(t[0])+'',t[1],'AM'];else if(cint(t[0])==12)var ret=['12',t[1],'PM'];else var ret=[(cint(t[0])-12)+'',t[1],'PM'];return ret;} wn.datetime.time_to_hhmm=function(hh,mm,am){if(am=='AM'&&hh=='12'){hh='00';}else if(am=='PM'&&hh!='12'){hh=cint(hh)+12;} -return hh+':'+mm;} +if(!mm)mm='00';if(!hh)hh='00';return hh+':'+mm;} function prettyDate(time){if(!time)return'' var date=time;if(typeof(time)=="string") date=new Date((time||"").replace(/-/g,"/").replace(/[TZ]/g," ").replace(/\.[0-9]*/,""));var diff=(((new Date()).getTime()-date.getTime())/1000),day_diff=Math.floor(diff/86400);if(isNaN(day_diff)||day_diff<0) diff --git a/js/all-web.js b/js/all-web.js index 41a208d97f..877b541657 100644 --- a/js/all-web.js +++ b/js/all-web.js @@ -499,11 +499,11 @@ return(hh.length==1?'0'+hh:hh)+':'+(mm.length==1?'0'+mm:mm);}} wn.datetime.only_date=function(val){if(val==null||val=='')return null;if(val.search(':')!=-1){var tmp=val.split(' ');var d=tmp[0].split('-');}else{var d=val.split('-');} if(d.length==3) val=d[2]+'-'+d[1]+'-'+d[0];return val;} -wn.datetime.time_to_ampm=function(v){if(!v){var d=new Date();var t=[d.getHours(),cint(d.getMinutes()/5)*5]}else{var t=v.split(':');} +wn.datetime.time_to_ampm=function(v){if(!v){var d=new Date();var t=[d.getHours(),cint(d.getMinutes()/5)*5+'']}else{var t=v.split(':');} if(t.length!=2){show_alert('[set_time] Incorect time format');return;} if(cint(t[0])==0)var ret=['12',t[1],'AM'];else if(cint(t[0])<12)var ret=[cint(t[0])+'',t[1],'AM'];else if(cint(t[0])==12)var ret=['12',t[1],'PM'];else var ret=[(cint(t[0])-12)+'',t[1],'PM'];return ret;} wn.datetime.time_to_hhmm=function(hh,mm,am){if(am=='AM'&&hh=='12'){hh='00';}else if(am=='PM'&&hh!='12'){hh=cint(hh)+12;} -return hh+':'+mm;} +if(!mm)mm='00';if(!hh)hh='00';return hh+':'+mm;} function prettyDate(time){if(!time)return'' var date=time;if(typeof(time)=="string") date=new Date((time||"").replace(/-/g,"/").replace(/[TZ]/g," ").replace(/\.[0-9]*/,""));var diff=(((new Date()).getTime()-date.getTime())/1000),day_diff=Math.floor(diff/86400);if(isNaN(day_diff)||day_diff<0)