mongo-date-to-youtube-date-converter
v1.1.0
Published
Converts MongoDb date to Youtube like date format
Readme
Mongo Date to YouTube Date Converter
Usage
To use this module, follow these steps:
Install the package via npm:
npm install mongo-date-to-youtube-date-converterImport the function into your Node.js application:
// Import the function const { formatMongoDateToYouTubeDate } = require('mongo-date-to-youtube-date-converter');Define a MongoDB date string:
const mongoDate = '2024-03-09T12:00:00Z';Convert the MongoDB date to YouTube-like format:
const youtubeDate = formatMongoDateToYouTubeDate(mongoDate);Print the result:
console.log(youtubeDate); // Output: '2 hours ago'
