Showing: 11 - 20 of 21 Articles

Important Moment.js functions for JavaScript

Below are some very important functions that you will need while working with timestamp or date in JavaScript. // returns current timestamp const set_current_timestamp = function() { returnmoment().format(‘X’); }; // converts timestamp to date // pass timestamp in function const getDateFormatFromTimeStamp = function(dt) { returnmoment.unix(dt).format(‘MM/DD/YYYY’); }; …

Finding location within the certain range of Latitude & Longitude using Node.js and MongoDB

In this post, I will explain by example how we can find nearest locations by given latitude and longitude with MongoDB. First step – Create schema:  // create geolocation Schema const GeoSchema = new Schema({    type: {        type:String,       …