Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

moment today date

moment().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 :: socket.io with express 
Javascript :: vue print date 
Javascript :: javascript convert string to number or integer 
Javascript :: send data in res.render in express js 
Javascript :: committing only part of a file git 
Javascript :: firebase storage javascript delete document 
Javascript :: append to url javascript 
Javascript :: javascript multiples of 3 and 5 
Javascript :: convert class object to json node js 
Javascript :: save token in localstorage 
Javascript :: js toggle boolean 
Javascript :: js wait 
Javascript :: javascript iterate over chars in string 
Javascript :: infinite loop javascript 
Javascript :: javascript split string only on first instance of specified character 
Javascript :: check if file is empty javascript fs 
Javascript :: how to return json response in flask 
Javascript :: get number from range line js 
Javascript :: javascript animate elements 
Javascript :: javascript set checkbox checked based on value 
Javascript :: remove last char - jquery 
Javascript :: invalid time value react datepicker 
Javascript :: splidejs pause 
Javascript :: javascript check if two keys are pressed 
Javascript :: array int to string javascript 
Javascript :: flattenDeep in es 6 without lodash 
Javascript :: Uncaught (in promise): NullInjectorError 
Javascript :: string.find javascript 
Javascript :: javascript access php variable 
Javascript :: split text and join in js 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =