correcting date format
This commit is contained in:
1 parent
520a68ad49
commit
50c2a47034
3 files changed
+13
-5
No files matched your search
@@ -9,6 +9,8 @@ import {
|
||||
import { withStyles } from '@material-ui/core/styles'
|
||||
import styles from './styles'
|
||||
|
||||
import { toLocalTime } from '../../utils'
|
||||
|
||||
class Event extends React.Component {
|
||||
render () {
|
||||
const classes = this.props.classes
|
||||
@@ -25,8 +27,8 @@ class Event extends React.Component {
|
||||
<Grid container spacing={16}>
|
||||
<Grid item xs>
|
||||
<Typography gutterBottom variant='headline'> {name} </Typography>
|
||||
<Typography gutterBottom>From : {startDatetime} </Typography>
|
||||
<Typography gutterBottom>To : {finishDatetime} </Typography>
|
||||
<Typography gutterBottom>From : {toLocalTime(startDatetime)} </Typography>
|
||||
<Typography gutterBottom>To : {toLocalTime(finishDatetime)} </Typography>
|
||||
</Grid>
|
||||
<Grid item xs>
|
||||
<Typography gutterBottom>Hosted by: {host.alias} ({host.lastName} {host.firstName}) </Typography>
|
||||
|
||||
@@ -9,6 +9,8 @@ import {
|
||||
import { withStyles } from '@material-ui/core/styles'
|
||||
import styles from './styles'
|
||||
|
||||
import { toLocalTime } from '../../utils'
|
||||
|
||||
class Event extends React.Component {
|
||||
render () {
|
||||
const classes = this.props.classes
|
||||
@@ -25,8 +27,8 @@ class Event extends React.Component {
|
||||
<Grid container spacing={16}>
|
||||
<Grid item xs>
|
||||
<Typography gutterBottom variant='headline'> {name} </Typography>
|
||||
<Typography gutterBottom>From : {startDatetime} </Typography>
|
||||
<Typography gutterBottom>To : {finishDatetime} </Typography>
|
||||
<Typography gutterBottom>From : {toLocalTime(startDatetime)} </Typography>
|
||||
<Typography gutterBottom>To : {toLocalTime(finishDatetime)} </Typography>
|
||||
</Grid>
|
||||
<Grid item xs>
|
||||
<Typography gutterBottom>Hosted by: {host.alias} ({host.lastName} {host.firstName}) </Typography>
|
||||
|
||||
@@ -2,5 +2,9 @@ export const toLocalTime = (epoch) => {
|
||||
let localDate = new Date(0)
|
||||
localDate.setUTCSeconds(epoch)
|
||||
var options = { year: 'numeric', month: 'long', day: '2-digit' }
|
||||
return localDate.toLocaleDateString(options) + ' ' + localDate.toLocaleTimeString('en-US')
|
||||
return (
|
||||
localDate.toLocaleDateString(options) +
|
||||
' at ' +
|
||||
localDate.toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit' })
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user