dm-web-react
Version:
The DM web client with React.
57 lines • 2.24 kB
JavaScript
import { DateUtils } from "ts-commons";
var fromEntity = function (entity) {
var formatDate = "";
try {
var date = DateUtils.timestampToDate(entity.issueDataTime);
var year = date.getFullYear();
var month = date.getMonth() + 1; // getMonth() is zero-indexed, so we'll increment to get the correct month number
var day = date.getDate();
var now = new Date();
var isToday = now.getFullYear() === year && now.getMonth() + 1 === month && now.getDate() === day;
formatDate = isToday ? DateUtils.toString(date, "HH:mm:ss") : DateUtils.toString(date, "yyyy-MM-dd HH:mm:ss");
}
catch (e) {
console.error(e);
}
var dto = {
dataId: entity.dataId,
quoteId: entity.quoteId,
bondUniCode: entity.bondUniCode,
tenor: entity.tenor,
expirationHoilday: entity.expirationHoilday,
bondCode: entity.bondCode,
bondShortName: entity.bondShortName,
bidVolume: entity.bidVolume,
bid: entity.bid,
bidValue: entity.bidValue,
ofr: entity.ofr,
ofrValue: entity.ofrValue,
ofrVolume: entity.ofrVolume,
chinaBond: entity.chinaBond,
tradeSubChinaBond: entity.tradeSubChinaBond,
macd: entity.macd,
ratingList: entity.ratingList,
instRating: entity.instRating,
brokerType: entity.brokerType,
bidSubChinaBond: entity.bidSubChinaBond,
chinaBondSubOfr: entity.chinaBondSubOfr,
issueDataTime: formatDate,
instInvestmentAdvice: entity.instInvestmentAdvice,
pdRating: entity.pdRating,
maxHistoryRating: entity.maxHistoryRating,
csIndex: entity.csIndex,
bidSubCsIndex: entity.bidSubCsIndex,
csIndexSubOfr: entity.csIndexSubOfr,
tradeSubCsIndex: entity.tradeSubCsIndex,
chinaDevelopment: entity.chinaDevelopment,
};
return dto;
};
export { fromEntity };
var BrokerMarketBestPriceDto = /** @class */ (function () {
function BrokerMarketBestPriceDto() {
}
return BrokerMarketBestPriceDto;
}());
export { BrokerMarketBestPriceDto };
//# sourceMappingURL=brokerMarketBestPriceDto.js.map