Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
the-gatekeeper committed May 20, 2017
2 parents 9eb3dc5 + d354f34 commit ebfbf02
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 3 deletions.
11 changes: 11 additions & 0 deletions components/formatCustomDate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import moment from 'moment';
import parseCustomDateString from './parseCustomDateString';

export default function formatCustomDateString(weirdDate) {
let result = weirdDate;
if (typeof weirdDate === 'string') {
result = parseCustomDateString(weirdDate);
}

return moment(result).format('LLLL');
}
6 changes: 6 additions & 0 deletions components/parseCustomDateString.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

export default function parseCustomDateString(weirdDate) {
let [date, time, offset, utc] = weirdDate.split(' ');
let isoDate = `${date}T${time}+${offset[1] + '' + offset[2]}:${offset[3] + '' + offset[4]}`;
return new Date(isoDate);
}
11 changes: 9 additions & 2 deletions components/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
Image
//$FlowFixMe
} from "react-vr";
import dateFormatter from "./formatCustomDate";

import { type Speaker } from "../query";
const defaultURL = "https://facebook.github.io/react/img/logo_og.png";
Expand All @@ -26,6 +27,10 @@ export default class ViewColoredBoxesWithText extends Component {

render() {
const { avatarUrl, name, talks } = this.props.speaker;

let highlighted = {
fontWeight: 500
}
return (
<View
style={{
Expand All @@ -43,10 +48,12 @@ export default class ViewColoredBoxesWithText extends Component {
<View
style={{ width: 3, height: 2}}
>
<Text style={{ fontSize: 0.2, textAlign: "left" }}>Name:</Text>
<Text style={[{ fontSize: 0.2, textAlign: "left" }, highlighted]}>Name:</Text>
<Text style={{ fontSize: 0.2, textAlign: "left", marginBottom: 0.1 }}>{name}</Text>
<Text style={{ fontSize: 0.2, textAlign: "left" }}>Talk:</Text>
<Text style={[{ fontSize: 0.2, textAlign: "left" }, highlighted]}>Talk:</Text>
<Text style={{ fontSize: 0.2, textAlign: "left" }}>{talks[0].title}</Text>
<Text style={[{ fontSize: 0.2, textAlign: "left" }, highlighted]}>Start date:</Text>
<Text style={{ fontSize: 0.2, textAlign: "left" }}>{dateFormatter(talks[0].startDate)}</Text>
</View>
</View>
);
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"test": "jest"
},
"dependencies": {
"moment": "^2.18.1",
"ovrui": "^1.1.0",
"react": "~15.4.1",
"react-native": "~0.42.0",
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2817,7 +2817,7 @@ mkdirp@^0.5.1:
dependencies:
minimist "0.0.8"

moment@2.x.x:
moment@2.x.x, moment@^2.18.1:
version "2.18.1"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.18.1.tgz#c36193dd3ce1c2eed2adb7c802dbbc77a81b1c0f"

Expand Down

0 comments on commit ebfbf02

Please sign in to comment.