У меня есть json ответ:
id: 30
tableName: "UserCredit"
keyValues: "{"Id":39}"
oldValues: "{"CoinLastUpdate":"2020-02-18T14:18:13.5155426+00:00","ScoreLastUpdate":"2020-02-18T14:18:13.5155429+00:00"}"
newValues: "{"CoinLastUpdate":"2020-02-18T14:18:15.7325823+00:00","ScoreLastUpdate":"2020-02-18T14:18:15.7325826+00:00"}"
auditType: "Update"
createdOnUtc: "2020-02-18T14:18:15.7338989Z"
createdByRefId: 39
Я хочу найти разницу между oldValues
и newValues
, тогда я пишу этот код:
setOldNewValue(item: DeiffrentModel): void {
let oldValue;
let newValue;
console.log(item.oldValues)
if (item.newValues !== null) {
newValue = item.newValues.split(',');
}
if (item.oldValues !== null) {
oldValue = item.oldValues.split(',');
}
for (let index = 0; index < newValue.length; index++) {
let addModel = {} as DeifferModel;
addModel.field = 'id';
addModel.newValue = newValue[index];
console.log(oldValue)
if (oldValue !== undefined) {
addModel.oldValue = oldValue[index]
}
this.differModel.push(addModel);
}
this.findDiffrent = _.difference(newValue, oldValue);
}
Теперь у меня есть такая проблема:
**** Я создаю в newValue
и oldValue
массив значений, но он выглядит так:
0: " CoinLastUpdate ":" 2020-02-18T14: 18: 13.5155426 + 00: 00 "
1:" ScoreLastUpdate ":" 2020-02-18T14: 18: 13.5155429 + 00: 00 "}
но мне нужно просто 2020-02-18T14:18:13.5155429+00:00
Как я могу решить эту проблему?