Skip to content

Commit

Permalink
Merge pull request #516 from tomaszkubacki/patch-1
Browse files Browse the repository at this point in the history
show dates with time when necessary
  • Loading branch information
mythz committed Mar 15, 2013
2 parents e870bc7 + 2130ad3 commit 77b5b3e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/ServiceStack/WebHost.Endpoints/Formats/HtmlFormat.html
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,22 @@ <h3>This reports json data source</h3>
return m.length ? arr(m) : obj(m);
}
function num(m) { return m; }
function str(m) {
return m.substr(0,6) == '/Date(' ? dmft(date(m)) : m;
function strFact(showFullDate){

function shortDate(m){
return m.substr(0,6) == '/Date(' ? dmft(date(m)) : m;
}

function fullDate(m){
return m.substr(0,6) == '/Date(' ? dmfthm(date(m)) : m;
}
return showFullDate ? fullDate : shortDate;
}
str = strFact(location.hash.indexOf('show=') != -1 && location.hash.indexOf('fulldates') != -1);
function date(s) { return new Date(parseFloat(/Date\(([^)]+)\)/.exec(s)[1])); }
function pad(d) { return d < 10 ? '0'+d : d; }
function dmft(d) { return d.getFullYear() + '/' + pad(d.getMonth() + 1) + '/' + pad(d.getDate()); }
function dmfthm(d) { return d.getFullYear() + '/' + pad(d.getMonth() + 1) + '/' + pad(d.getDate()) + ' ' + pad(d.getHours()) + ":" + pad(d.getMinutes()); }
function show(k) { return typeof k != 'string' || k.substr(0,2) != '__'; }
function obj(m) {
var sb = '<dl>';
Expand Down

0 comments on commit 77b5b3e

Please sign in to comment.