Skip to content

Commit

Permalink
fix: handle null better
Browse files Browse the repository at this point in the history
  • Loading branch information
AshotN committed Aug 1, 2024
1 parent 0d65eea commit 03e68b6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/frontend/components/property-type/datetime/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import allowOverride from '../../../hoc/allow-override.js'
import { useTranslation } from '../../../hooks/index.js'
import { PropertyType } from '../../../../backend/index.js'

const formatDate = (val:any, propertyType: PropertyType) => (propertyType === 'date' ? `${val}T00:00:00` : val)
const formatDate = (val:string|null, propertyType: PropertyType) => {
if (val) return (propertyType === 'date' ? `${val}T00:00:00` : val)
return ''
}

const Edit: React.FC<EditPropertyProps> = (props) => {
const { property, onChange, record } = props
Expand Down

0 comments on commit 03e68b6

Please sign in to comment.