Skip to content

Commit

Permalink
create Iprop interface instead of using propTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
dzonidoo committed Nov 6, 2024
1 parent 8bba775 commit 59b0cff
Showing 1 changed file with 15 additions and 22 deletions.
37 changes: 15 additions & 22 deletions client/components/UI/DateTime.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
import React from 'react';
import PropTypes from 'prop-types';
import moment from 'moment';

import {appConfig} from 'appConfig';
import {superdeskApi} from '../../superdeskApi';
import {timeUtils} from '../../utils';

import './style.scss';
import {IDateTime} from 'interfaces';

interface IPropsDateTime {
date: IDateTime,
withTime?: boolean,
withYear?: boolean,
withDate?: boolean,
padLeft?: boolean,
toBeConfirmed?: boolean,
isFullDay?: boolean,
isEndEventDateTime?: boolean,
noEndTime?: boolean,
multiDay?: boolean,
}

/**
* @ngdoc react
Expand All @@ -24,7 +37,7 @@ function DateTime({
isEndEventDateTime,
noEndTime,
multiDay,
}) {
}: IPropsDateTime) {
const {gettext} = superdeskApi.localization;
const dateFormat = appConfig.planning.dateformat;
const timeFormat = appConfig.planning.timeformat;
Expand Down Expand Up @@ -71,24 +84,4 @@ function DateTime({
);
}

DateTime.propTypes = {
date: PropTypes.oneOfType([PropTypes.object, PropTypes.string]).isRequired,
withTime: PropTypes.bool,
withYear: PropTypes.bool,
withDate: PropTypes.bool,
padLeft: PropTypes.bool,
toBeConfirmed: PropTypes.bool,
isFullDay: PropTypes.bool,
isEndEventDateTime: PropTypes.bool,
noEndTime: PropTypes.bool,
multiDay: PropTypes.bool,
};

DateTime.defaultProps = {
withTime: true,
withDate: true,
withYear: true,
padLeft: false,
};

export default DateTime;

0 comments on commit 59b0cff

Please sign in to comment.