Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

moment today date

moment().format('YYYY-MM-DD')
Comment

Get current date in javascript using moment()

// using moment()
var now	= moment();
let today = now.format('YYYY-MM-DD');
Comment

moment is today

moment().isSame('2022-06-28', 'day');
Comment

how to get today in moment js

// call this function, passing-in your date
function dateToFromNowDaily( myDate ) {

    // get from-now for this date
    var fromNow = moment( myDate ).fromNow();

    // ensure the date is displayed with today and yesterday
    return moment( myDate ).calendar( null, {
        // when the date is closer, specify custom values
        lastWeek: '[Last] dddd',
        lastDay:  '[Yesterday]',
        sameDay:  '[Today]',
        nextDay:  '[Tomorrow]',
        nextWeek: 'dddd',
        // when the date is further away, use from-now functionality             
        sameElse: function () {
            return "[" + fromNow + "]";
        }
    });
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript remove parentheses 
Javascript :: clone object in js 
Javascript :: how to download image in canvas javascript as named 
Javascript :: add classnames to body 
Javascript :: jquery add attribute 
Javascript :: react fetch post 
Javascript :: fontawsome icon size react element 
Javascript :: copyright in javascript 
Javascript :: how to remove the last character of a string in javascript 
Javascript :: vue deep watch 
Javascript :: how to install font-awesome 
Javascript :: before send ajax loading 
Javascript :: vue get window width 
Javascript :: javascript reduce function to get sum of object value 
Javascript :: js random id 
Javascript :: node js fetch 
Javascript :: uuid generator pure javascript 
Javascript :: js stop form submit on enter 
Javascript :: how to see if user clicked key in js 
Javascript :: remove last character from string js 
Javascript :: user agent chrome 
Javascript :: get search params from url react 
Javascript :: vimeo regez video id 
Javascript :: add select option javascript 
Javascript :: title case javascript 
Javascript :: javascript fetch api post 
Javascript :: js sleep sync 
Javascript :: how to get a random element of an array javascript 
Javascript :: react dom 
Javascript :: express get full url 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =