mirror of
https://github.com/Art051/it-tools.git
synced 2025-08-11 19:29:03 +00:00
feat(date-converter): added mongodb objectID format
This commit is contained in:
@@ -132,5 +132,10 @@ const formats: Format[] = [
|
|||||||
fromDate: (date) => date.toUTCString(),
|
fromDate: (date) => date.toUTCString(),
|
||||||
toDate,
|
toDate,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'Mongo ObjectID',
|
||||||
|
fromDate: (date) => Math.floor(date.getTime() / 1000).toString(16) + '0000000000000000',
|
||||||
|
toDate: (objectId) => new Date(parseInt(objectId.substring(0, 8), 16) * 1000),
|
||||||
|
},
|
||||||
];
|
];
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user