angular2-jsonapi icon indicating copy to clipboard operation
angular2-jsonapi copied to clipboard

DateConverter changed implementation on v8.2.1

Open dudumanbogdan opened this issue 5 years ago • 3 comments

Hello,

Can you please indicate an idea how to solve the problem of DateConverter implementation in version 8 as after updating from v6, our application has lots of breaking issues.

For example if we get undefined value for a Date property, the:

Initially, the implementation of date.converter.js for unmask was:

import { format, parse } from 'date-fns';

unmask(value: any) { return format(value, 'YYYY-MM-DDTHH:mm:ssZ'); // with Undefined it was OK }

Now:

DateConverter.prototype.unmask = /**
 * @param {?} value
 * @return {?}
 */
function (value) {
    return value.toISOString(); // with Undefined it is NOT OK :(
};

Thanks for any suggestion!

dudumanbogdan avatar Jan 20 '20 12:01 dudumanbogdan

It's a very big problem. With that issue it's not possible to deal with nullable datetime value.... Big issue....

bosk59 avatar Feb 10 '20 09:02 bosk59

Maybe @frans-beech-it could adjust his pull request, to not only handle null but also undefined values: https://github.com/ghidoz/angular2-jsonapi/pull/252.

But since it seems, that it will take some time until this is merged, you could got with the solution documented here: https://github.com/ghidoz/angular2-jsonapi/issues/242#issuecomment-532276090

hpawe01 avatar Feb 20 '20 14:02 hpawe01

In the end this is what I did, after searching more! Thanks for the feedback. I didn't expected to have this issue on upgrading the library; good that we have managed to fix all the breaking changes.

dudumanbogdan avatar Feb 21 '20 11:02 dudumanbogdan