Skip to content

Commit

Permalink
better timestamp formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Visnu Pitiyanuvath committed Sep 18, 2011
1 parent 3fb98c3 commit 64135b4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions console.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var repl = require('repl')
, context = repl.start().context;

context.app = require('./config/application');
context.Date = Date;
context.Item = context.app.db.model('Item');

process.stdin.on('close', function() {
Expand Down
4 changes: 3 additions & 1 deletion lib/strftime.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
var strftime = require('strftime').strftime;
Date.prototype.toLocaleFormat = function toLocaleFormat(fmt) { strftime(fmt, this); };
Date.prototype.toLocaleFormat = function toLocaleFormat(fmt) {
return strftime(fmt, this);
};
4 changes: 1 addition & 3 deletions public/stylesheets/all.styl
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ table.hour
color white
text-shadow 0 -1px 0 hsla(0, 0%, 0%, 0.5)
padding 5px
&.hour
width 5em
&.duration
&.hour, &.duration
width 3em
&.app
width 10em
Expand Down
6 changes: 4 additions & 2 deletions views/items/index.jade
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ h1= items[0].start.toDateString()
- if (items)
table.hour
tr
th.hour= items[0].start.toLocaleFormat('%H:%M')
th: input( type="checkbox" )
th.hour= items[0].start.toLocaleFormat('%l %p')
th.duration duration
th.app app
th.title title
- each item in items
tr
td= item.start.toLocaleTimeString()
td: input( type="checkbox" )
td!= item.start.toLocaleFormat('%l:<b>%M:%S</b>')
td.duration
- if (item.duration > 60)
= (item.duration / 60).toFixed(0) + ' m'
Expand Down

0 comments on commit 64135b4

Please sign in to comment.