mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-24 08:46:15 -04:00
feat(date-converter): added mongodb objectID format
This commit is contained in:
parent
7f229959d6
commit
4ef25887b9
1 changed files with 5 additions and 0 deletions
|
@ -132,5 +132,10 @@ const formats: Format[] = [
|
|||
fromDate: (date) => date.toUTCString(),
|
||||
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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue