Client - fix editing a workout with gpx file

This commit is contained in:
Sam 2019-12-29 10:23:49 +01:00
parent c2815ae47b
commit 038610e7f6

View File

@ -6,17 +6,18 @@ import {
editActivity, editActivity,
} from '../../../actions/activities' } from '../../../actions/activities'
import { history } from '../../../index' import { history } from '../../../index'
import { getDateWithTZ } from '../../../utils'
import { formatActivityDate, translateSports } from '../../../utils/activities' import { formatActivityDate, translateSports } from '../../../utils/activities'
function FormWithoutGpx(props) { function FormWithoutGpx(props) {
const { activity, onAddOrEdit, sports, t } = props const { activity, onAddOrEdit, sports, t, user } = props
const translatedSports = translateSports(sports, t) const translatedSports = translateSports(sports, t)
let activityDate, let activityDate,
activityTime, activityTime,
sportId = '' sportId = ''
if (activity) { if (activity) {
const activityDateTime = formatActivityDate( const activityDateTime = formatActivityDate(
activity.activity_date, getDateWithTZ(activity.activity_date, user.timezone),
'yyyy-MM-dd' 'yyyy-MM-dd'
) )
activityDate = activityDateTime.activity_date activityDate = activityDateTime.activity_date
@ -133,7 +134,9 @@ function FormWithoutGpx(props) {
} }
export default connect( export default connect(
() => ({}), state => ({
user: state.user,
}),
dispatch => ({ dispatch => ({
onAddOrEdit: (e, activity) => { onAddOrEdit: (e, activity) => {
const d = e.target.form.duration.value.split(':') const d = e.target.form.duration.value.split(':')