我有这个数组,已经按上传时间排序
[
{ id: 1133, userId: 101697, uploadTime: '2020-09-14T16:19:16.000Z' },
{ id: 1132, userId: 101543, uploadTime: '2020-09-14T16:17:27.000Z' },
{ id: 1131, userId: 101697, uploadTime: '2020-09-14T16:09:49.000Z' },
{ id: 1130, userId: 101697, uploadTime: '2020-09-14T16:09:16.000Z' },
{ id: 1128, userId: 101543, uploadTime: '2020-09-09T21:48:46.000Z' },
{ id: 1127, userId: 101543, uploadTime: '2020-09-09T21:41:41.000Z' },
{ id: 1126, userId: 101543, uploadTime: '2020-09-09T21:35:37.000Z' },
{ id: 1125, userId: 101543, uploadTime: '2020-09-09T19:41:57.000Z' },
{ id: 1082, userId: 101577, uploadTime: '2020-08-21T15:24:35.000Z' },
{ id: 1049, userId: 101589, uploadTime: '2020-08-15T23:31:42.000Z' },
{ id: 1040, userId: 101589, uploadTime: '2020-08-14T15:04:01.000Z' },
{ id: 1036, userId: 101589, uploadTime: '2020-08-13T00:09:43.000Z' },
{ id: 1035, userId: 101527, uploadTime: '2020-08-12T20:07:34.000Z' },
{ id: 1034, userId: 101612, uploadTime: '2020-08-12T17:33:26.000Z' },
{ id: 996, userId: 101589, uploadTime: '2020-08-11T15:20:11.000Z' },
{ id: 889, userId: 101626, uploadTime: '2020-08-06T14:47:18.000Z' },
{ id: 864, userId: 101589, uploadTime: '2020-08-05T15:23:50.000Z' },
{ id: 863, userId: 101589, uploadTime: '2020-08-05T14:42:14.000Z' },
{ id: 852, userId: 101589, uploadTime: '2020-08-04T18:05:07.000Z' },
{ id: 851, userId: 101589, uploadTime: '2020-08-04T17:57:58.000Z' }
]
现在我想求助于它,但仅适用于具有相同 userId 且 uploadTime 距当前时间不到 24 小时的对象。输出应该是这样的:
[
{ id: 1133, userId: 101697, uploadTime: '2020-09-14T16:19:16.000Z' },
{ id: 1131, userId: 101697, uploadTime: '2020-09-14T16:09:49.000Z' },
{ id: 1130, userId: 101697, uploadTime: '2020-09-14T16:09:16.000Z' },
{ id: 1132, userId: 101543, uploadTime: '2020-09-14T16:17:27.000Z' },
]
holdtom
小唯快跑啊
哔哔one
慕村9548890
相关分类