Skip to content

Commit

Permalink
put pythonify datetime back in to fix dates being in the wrong order
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieRL committed Jul 31, 2018
1 parent ab55163 commit b9f5ff5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { FormInput } from '../../inputs'
import TemplateSelectInput from '../../inputs/selects/TemplateSelectInput'

import FieldGroup from '../../fields/FieldGroup'
import { dateObjToAPIString } from '../../../util/helpers'
import { pythonifyDateTime } from '../../../util/helpers'

class TemplateTabComponent extends React.Component {

Expand All @@ -18,7 +18,7 @@ class TemplateTabComponent extends React.Component {

updateField(name, value) {
if (value instanceof Date) {
value = dateObjToAPIString(value)
value = pythonifyDateTime(value)
}
this.props.update(
'template_data',
Expand Down
9 changes: 9 additions & 0 deletions dispatch/static/manager/src/js/util/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ export function humanizeDatetime(timestamp, isDateTime) {
moment(timestamp).format('ll') // April 18, 2017
}

export function pythonifyDateTime(timestamp) {

if (!timestamp) {
return null
}

return moment(timestamp).format()
}

export function confirmNavigation(router, route, shouldConfirm) {
router.setRouteLeaveHook(
route,
Expand Down

0 comments on commit b9f5ff5

Please sign in to comment.