Skip to content

Commit

Permalink
Merge pull request #159 from jekyll/safari-datetime
Browse files Browse the repository at this point in the history
Fix Safari datetime parsing
  • Loading branch information
benbalter authored Aug 23, 2016
2 parents b29c130 + 03f13b9 commit 5e61870
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"license": "MIT",
"dependencies": {
"brace": "^0.8.0",
"dateformat": "^1.0.12",
"isomorphic-fetch": "^2.2.1",
"js-yaml": "^3.6.1",
"lodash": "^4.13.1",
Expand Down
7 changes: 3 additions & 4 deletions src/components/metadata/MetaSimple.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { Component, PropTypes } from 'react';
import TextareaAutosize from 'react-textarea-autosize';
import _ from 'underscore';
import DateTimePicker from 'react-widgets/lib/DateTimePicker';
import dateformat from 'dateformat';
import moment from 'moment';
import momentLocalizer from 'react-widgets/lib/localizers/moment';
import 'react-widgets/dist/css/react-widgets.css';
Expand All @@ -16,9 +15,9 @@ export class MetaSimple extends Component {
updateFieldValue(nameAttr, e.target.value);
}

handleDatepickerChange(value, dateStr) {
handleDatepickerChange(date, dateStr) {
const { nameAttr, fieldValue, updateFieldValue } = this.props;
let formatted = dateformat(dateStr, "yyyy-mm-dd HH:MM:ss");
let formatted = moment(date).format("YYYY-MM-DD hh:mm:ss");
updateFieldValue(nameAttr, formatted);
}

Expand All @@ -37,7 +36,7 @@ export class MetaSimple extends Component {
let dateValue = (new Date(fieldValue) == 'Invalid Date') ? null : new Date(fieldValue);
return (
<DateTimePicker
onChange={(v, d) => this.handleDatepickerChange(null, d)}
onChange={(v, d) => this.handleDatepickerChange(v, d)}
className="date-field"
defaultValue={dateValue} />
);
Expand Down
4 changes: 2 additions & 2 deletions src/containers/views/Documents.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import _ from 'underscore';
import { capitalize } from '../../utils/helpers';
import dateformat from 'dateformat';
import moment from 'moment';

// Constants
import { ADMIN_PREFIX } from '../../constants';
Expand Down Expand Up @@ -73,7 +73,7 @@ export class Documents extends Component {
<Link to={to}>{title}</Link>
</strong>
</td>
<td>{dateformat(doc.date, "mmm dd, yyyy")}</td>
<td>{moment(doc.date).format("LLL").toString()}</td>
<td>
<div className="row-actions">
<a onClick={() => this.handleClickDelete(filename, collection)} title="Delete">
Expand Down

0 comments on commit 5e61870

Please sign in to comment.