From b9f5ff5bb9cb80f6a515021553208c441c71e5cc Mon Sep 17 00:00:00 2001 From: JamieRL Date: Tue, 31 Jul 2018 14:34:37 -0700 Subject: [PATCH] put pythonify datetime back in to fix dates being in the wrong order --- .../manager/src/js/components/Editor/tabs/TemplateTab.js | 4 ++-- dispatch/static/manager/src/js/util/helpers.js | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/dispatch/static/manager/src/js/components/Editor/tabs/TemplateTab.js b/dispatch/static/manager/src/js/components/Editor/tabs/TemplateTab.js index 7310165c5..ab64b36e8 100644 --- a/dispatch/static/manager/src/js/components/Editor/tabs/TemplateTab.js +++ b/dispatch/static/manager/src/js/components/Editor/tabs/TemplateTab.js @@ -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 { @@ -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', diff --git a/dispatch/static/manager/src/js/util/helpers.js b/dispatch/static/manager/src/js/util/helpers.js index 1cbcccc88..ae24060ce 100644 --- a/dispatch/static/manager/src/js/util/helpers.js +++ b/dispatch/static/manager/src/js/util/helpers.js @@ -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,