Permalink
Browse files

fixes for created_at field

  • Loading branch information...
1 parent 76f66ff commit 5dc9fd7d84731eba8de795df6b7e0c2a473c1618 @leafnode committed Dec 16, 2011
Showing with 5 additions and 1 deletion.
  1. +5 −1 app.php
View
@@ -54,7 +54,7 @@
$paste = array(
'_id' => substr(hash('sha512', $content . time() . rand(0, 255)), 0, 8),
'content' => $content,
- 'createdAt' => new MongoDate(),
+ 'created_at' => new MongoDate(),
);
if ('' === trim($paste['content'])) {
@@ -86,6 +86,10 @@
throw new NotFoundHttpException('paste not found');
}
+ $time = explode(' ', $paste['created_at']);
+ $dt = new DateTime();
+ $paste['created_at'] = $dt->setTimestamp((float)$time[0] + (int)$time[1]);
+
return $app['twig']->render('view.html', array(
'copy_url' => $app['url_generator']->generate('homepage', array('parent' => $paste['_id'])),
'paste' => $paste,

0 comments on commit 5dc9fd7

Please sign in to comment.