Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug #4840 - Fix UTC DateColumn value display #4841

Merged
merged 1 commit into from
Oct 29, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Bug - Fix UTC DateColumn vaue display
Added toMoment method to allow Moment.js to use utc dates.
Updated getValue to use toMoment for proper output.
alsoicode committed Oct 27, 2018
commit b47617ac7b773dcf2614c8476d5ac6d4222008e9
9 changes: 8 additions & 1 deletion fields/types/date/DateColumn.js
Original file line number Diff line number Diff line change
@@ -10,12 +10,19 @@ var DateColumn = React.createClass({
data: React.PropTypes.object,
linkTo: React.PropTypes.string,
},
toMoment (value) {
if (this.props.col.field.isUTC) {
return moment.utc(value);
} else {
return moment(value);
}
},
getValue () {
const value = this.props.data.fields[this.props.col.path];
if (!value) return null;

const format = (this.props.col.type === 'datetime') ? 'MMMM Do YYYY, h:mm:ss a' : 'MMMM Do YYYY';
return moment(value).format(format);
return this.toMoment(value).format(format);
},
render () {
const value = this.getValue();