fix display renovation date, now use memomentjs

parent 97d4775c
...@@ -73,20 +73,7 @@ export default class DomainGeneralInfo extends React.Component { ...@@ -73,20 +73,7 @@ export default class DomainGeneralInfo extends React.Component {
} }
} }
renovationDate() { renovationDate() {
const utc = Utils.getUTCTime(this.props.domain.attrs.zimbraCreateTimestamp); return Utils.getRenovationDate(this.props.domain.attrs.zimbraCreateTimestamp);
if (!utc) {
return 'No disponible';
}
const timestamp = moment.utc(utc);
const now = moment();
timestamp.year(now.year());
if (timestamp.isBefore(now)) {
timestamp.add(1, 'year');
}
return timestamp.format('DD/MM/YYYY');
} }
render() { render() {
const domain = this.props.domain; const domain = this.props.domain;
......
...@@ -885,6 +885,22 @@ export function isDevMode() { ...@@ -885,6 +885,22 @@ export function isDevMode() {
return process.env.NODE_ENV === 'development'; return process.env.NODE_ENV === 'development';
} }
export function getRenovationDate(creationDate, noAvailable = 'No disponible') {
if (!creationDate) {
return noAvailable;
}
const domainCreationDate = moment(creationDate, 'YYYYMMDDHHmmssZ');
const now = moment();
domainCreationDate.year(now.year());
if (domainCreationDate.isBefore(now)) {
domainCreationDate.add(1, 'year');
}
return domainCreationDate.format('DD/MM/YYYY');
}
export function getTSFromUTC(utc) { export function getTSFromUTC(utc) {
let time = utc; let time = utc;
if (!time) { if (!time) {
......
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