Skip to content

Commit

Permalink
Fix for #1449
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi749 committed Jan 25, 2024
1 parent 190ae6d commit f4dfa18
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export function useEditStatusPanel() {
field.setValue(fieldValues)
)
const submit = useEditStatusPanelSubmit()

return {
headerText: activePanel?.headerText ?? strings.EditStatusPanelText,
isOpen,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useProjectPropertiesSection } from './useProjectPropertiesSection'

export const ProjectPropertiesSection: FC = () => {
const { section } = useContext(SectionContext)
const { fieldValues, fields } = useProjectPropertiesSection()
const { fieldValues, fieldValuesAsText, fields } = useProjectPropertiesSection()

/**
* Render fields specified in model.viewFields
Expand All @@ -20,12 +20,23 @@ export const ProjectPropertiesSection: FC = () => {
const [field] = fields.filter(
({ InternalName, Title }) => [InternalName, Title].indexOf(fieldName) !== -1
)
if (field && !stringIsNullOrEmpty(fieldValues[fieldName])) {
if (field && !stringIsNullOrEmpty(fieldValuesAsText[fieldName])) {
if (field.TypeAsString === 'DateTime' || field.TypeAsString === 'Date') {
const date = new Date(fieldValues[fieldName])
return (
<StatusSectionField
key={fieldName}
label={field.Title}
value={date.toLocaleDateString()}
/>
)
}

return (
<StatusSectionField
key={fieldName}
label={field.Title}
value={fieldValues[fieldName]}
value={fieldValuesAsText[fieldName]}
/>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@ import { useProjectStatusContext } from '../../../ProjectStatus/context'

export function useProjectPropertiesSection() {
const context = useProjectStatusContext()

return {
fieldValues: {
...context.state.data.properties.fieldValues['_fieldValues'],
...context.state.selectedReport?.fieldValues['_fieldValues']
},
fieldValuesAsText: {
...context.state.data.properties.fieldValues['_fieldValuesAsText'],
...context.state.selectedReport?.fieldValues['_fieldValuesAsText']
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ export class SPDataAdapterBase<
: destinationUserIds
}
break
case 'Date':
case 'DateTime':
properties[field.InternalName] = fieldValues.get<Date>(field.InternalName, {
format: 'date',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,8 @@ export class PortalDataService extends DataService<IPortalDataServiceConfigurati
)()
const filteredColumnItems = columnItems.filter(
(col) =>
col.GtDataSourceCategory === dataSourceCategory || col.GtDataSourceCategory === null ||
col.GtDataSourceCategory === dataSourceCategory ||
col.GtDataSourceCategory === null ||
(!col.GtDataSourceCategory && !col.GtDataSourceLevel) ||
(!col.GtDataSourceCategory && _.contains(col.GtDataSourceLevel, level))
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const createFieldValueMap = (): Map<string, (value: EditableSPFieldValue)
name: term.Label
}))
],
['Date', ({ $ }) => new Date($)],
['DateTime', ({ $ }) => new Date($)],
['MultiChoice', ({ value }) => value.split(', ')],
[
Expand Down

0 comments on commit f4dfa18

Please sign in to comment.