Skip to content

Commit

Permalink
Add timestamps to photo info
Browse files Browse the repository at this point in the history
  • Loading branch information
inukshuk committed Jul 26, 2017
1 parent e1a0c2d commit 6cbf283
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions res/strings/renderer.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ photo:
file: File
size: Size
type: Type
created: Date Added
modified: Modified

template:
id: URI
Expand Down
8 changes: 7 additions & 1 deletion src/components/photo/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { PureComponent } = React
const { StaticField } = require('../metadata/field')
const { func, object } = require('prop-types')
const { basename } = require('path')
const { number, bytes } = require('../../format')
const { bytes, datetime, number } = require('../../format')


class PhotoInfo extends PureComponent {
Expand All @@ -32,6 +32,12 @@ class PhotoInfo extends PureComponent {
<StaticField
label="photo.size"
value={this.size}/>
<StaticField
label="photo.created"
value={datetime(this.props.photo.created)}/>
<StaticField
label="item.modified"
value={datetime(this.props.photo.modified)}/>
</ol>
)
}
Expand Down
2 changes: 1 addition & 1 deletion src/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const format = {
day: 'numeric',
hour: 'numeric',
minute: 'numeric'
}).format(new Date(value))
}).format(value instanceof Date ? value : new Date(value))
} catch (error) {
return value
}
Expand Down

0 comments on commit 6cbf283

Please sign in to comment.