1
0
mirror of https://github.com/alice-lg/alice-lg.git synced 2024-05-11 05:55:03 +00:00

30 lines
452 B
React
Raw Normal View History

2017-05-16 13:34:00 +02:00
/**
* Datetime Component
*
* @author Matthias Hannig <mha@ecix.net>
*/
import React from 'react'
import moment from 'moment'
2018-07-27 18:18:48 +02:00
import {parseServerTime} from './parse'
2017-05-16 13:34:00 +02:00
export default class Datetime extends React.Component {
render() {
let timefmt = this.props.format;
if (!timefmt) {
timefmt = 'LLLL';
}
2018-07-27 18:18:48 +02:00
let time = parseServerTime(this.props.value);
2017-05-16 13:34:00 +02:00
return (
<span>{time.format(timefmt)}</span>
);
}
}