Skip to content

Commit

Permalink
Update supplierController.ts and DateTimePicker.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
aelassas committed Dec 3, 2024
1 parent 2c4328f commit c2de20d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions api/src/controllers/supplierController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export const update = async (req: Request, res: Response) => {
payLater: supplier.payLater,
contracts: supplier.contracts,
minimumRentalDays: supplier.minimumRentalDays,
licenseRequired: supplier.licenseRequired,
})
}
logger.error('[supplier.update] Supplier not found:', _id)
Expand Down
6 changes: 3 additions & 3 deletions mobile/components/DateTimePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react'
import { StyleSheet, View, Pressable, Text } from 'react-native'
import ReactDateTimePicker from '@react-native-community/datetimepicker'
import { format } from 'date-fns'
import { enUS, fr } from 'date-fns/locale'
import { enUS, fr, es } from 'date-fns/locale'
import { MaterialIcons } from '@expo/vector-icons'
import * as bookcarsHelper from ':bookcars-helper'

Expand Down Expand Up @@ -44,13 +44,13 @@ const DateTimePicker = ({
const [label, setLabel] = useState('')
const [value, setValue] = useState<Date | undefined>(dateTimeValue)
const [show, setShow] = useState(false)
const [locale, setLoacle] = useState(dateTimeLocale === 'fr' ? fr : enUS)
const [locale, setLoacle] = useState(dateTimeLocale === 'fr' ? fr : dateTimeLocale === 'es' ? es : enUS)
const _format = mode === 'date' ? 'eeee, d LLLL yyyy' : 'kk:mm'
const now = new Date()
const small = size === 'small'

useEffect(() => {
const _locale = dateTimeLocale === 'fr' ? fr : enUS
const _locale = dateTimeLocale === 'fr' ? fr : dateTimeLocale === 'es' ? es : enUS
setLoacle(_locale)
setLabel((value && bookcarsHelper.capitalize(format(value, _format, { locale: _locale }))) || dateTimeLabel)
}, [dateTimeLocale]) // eslint-disable-line react-hooks/exhaustive-deps
Expand Down

0 comments on commit c2de20d

Please sign in to comment.