Server returns object with dates in wrong format
Faced with the next problem:
- Call server (entity) method from client (using connection.query)
- Server method calculate several dates put it in object and return to client in ctx.mParams.dates object
- On client side stringified dates in object looks like "2019-06-30Z" instead of "2018-12-29T00:00Z" or "2018-12-29T00:00:00.000Z" and not parsed using new Date in Mozilla FF
As temporary solution I stringified dates before return it to client.
Back-end implementation:
function calculateDates(ctx) {
const {execParams} = ctx.mParams
const {rfiDuration, auctionDuration, procedureID, fromToday} = execParams
...
const dates = calculateDatesBackwards(awardDate, durations, rfiDuration, auctionDuration)
ctx.mParams.rawDates = {
rfiDate: dates.rfiDate,
startDate: dates.startDate,
pubDate: dates.pubDate,
offerDate: dates.offerDate,
auctionDate: dates.auctionDate,
selectDate: dates.selectDate,
awardDate: dates.awardDate
}
ctx.mParams.dates = JSON.stringify(dates)
}
Edited by Митрошин Олександр