Commit 8b0e01ea authored by Viacheslav Pavlov's avatar Viacheslav Pavlov
Browse files

Merge branch '380-minor-catalog-updates' into 'master'

Resolve "Minor Catalog updates"

Closes #380

See merge request !304
parents 44d8053b 51244e52
Pipeline #6835 passed with stages
in 6 minutes and 1 second
......@@ -387,7 +387,7 @@ class DetailInfo extends React.Component<IDetailInfoProps, any> {
<Grid item xs={ 12 }>
<Grid container spacing={ 0 }>
<Properties>
<PropertiesItem title="Date of dataset:">{ dataset.created }</PropertiesItem>
<PropertiesItem title="Date of dataset:"><McpdDate value={ dataset.created }/></PropertiesItem>
<PropertiesItem title="Related resources:">{ dataset.source }</PropertiesItem>
<PropertiesItem title="Metadata create date:">
{ dataset.createdDate && <PrettyDate value={ dataset.createdDate } /> }
......
......@@ -63,6 +63,8 @@ class BasicInfoStep extends React.Component<ILoginContainerProps, any> {
name="created"
component={ TextField }
label="Date of creation of the dataset"
placeholder="YYYYMMDD. If the month or day are missing, this should be indicated with ‘00’ [double zero] (e.g. 1975----, 19750000; 197506--, 19750600)"
validate={ [ Validators.mcpdDate ] }
/>
<Field
name="rights"
......
import * as React from 'react';
import Validators from 'utilities/Validators';
export default function McpdDate({ value, locale = 'en-GB' }: { value: string, locale?: string }) {
......@@ -7,6 +8,10 @@ export default function McpdDate({ value, locale = 'en-GB' }: { value: string, l
return (<i>Date not provided</i>);
}
if (Validators.mcpdDate(value) === 'Invalid date') {
return <span>{ value }</span>;
}
const year = value.substr(0, 4);
const month = value.substr(4, 2);
const day = value.substr(6, 2);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment