Most voted "momentjs" questions
Moment.js is a Javascript date library for analyzing, manipulating, and formatting dates. Use this tag for questions related to Moment and Moment-Timezone plugins.
Learn more…34 questions
Sort by count of
-
4
votes1
answer213
viewsWhy is this call automatically inserted into the HTML body?
In an app I’m using the Javascript libraries: jQuery, Angular, Angular Material and Moment. Totaling I have the following calls in my file: <script src="vendor/jquery/jquery-3.1.1.js"…
-
3
votes1
answer114
viewsManipulação Momentjs
I’m using Moment.js to validate some dates and used the function moment().weeksInYear() to check which week of the year we are in. I need to make a date forecast, after the user informs me a date, I…
-
3
votes2
answers2000
viewsGenerate and format dates with Moment in Nodejs
I’m trying to use the Moment for formatting dates this way YYYY-MM-DD HH:mm:ss and would like to determine a period between 00:00:00 yesterday and 23:59:59 today. Example: considering today as…
-
3
votes2
answers4339
viewsDifference between start date and end date with Moment js
I need to inform how much time I have of a certain chronometer, I have the date of the moment at which I started the event. I’m developing with angular 4 typescript and use plugin Moment js In my…
-
3
votes2
answers1988
viewsHow to get the last day of a month with Momentjs?
I’m using MomentJS and I need to pick up the first and last day of the current month. Currently, to catch the first day of the month I’m doing so: var data_inicial = moment().format('01/MM/YYYY') So…
-
3
votes2
answers3118
viewsHow to format date with the name of the month in Portuguese and capitalized in Moment.js?
I need to format a date with the Moment.js thus: 10 de Dezembro/2018. I tried so: "DD [de] MMMM/YYYY" But the month is down to 1 letter. What’s wrong?…
-
3
votes1
answer835
viewsHow to add days to a date with Moment.js?
I’m trying to calculate the deadline of my site in days, IE, I put "14 days" and it turns into 00/00/0000. I’m doing it this way, but she’s taking the full date and turning it into days, I want to…
-
3
votes1
answer119
viewsMoment - problem with Timezone
I receive the service date as follows: 2020-11-05T06:15:00.000-03:00 To display to the user we use the library Moment. Example: import React from 'react'; import moment from 'moment'; var chegada =…
-
3
votes2
answers100
viewsProblem with Javascript date comparison
I have a Javascript function that is to check if the "current data_is" is larger than "data_validity". If larger, it is to display on the screen the "Expired" text, if not, keep the "Valid" text".…
-
2
votes2
answers1704
viewsHow to send request in Timestamp: yyyyMMddHHmmssffff format using Postman?
I need to use Postman to send a request to the API and in the header I need to send the date in format yyyyMMddHHmmssffff. I tried to use Moment.js this way, but it doesn’t seem to work: const…
-
2
votes1
answer567
viewsReact-Native Moment returns wrong day
I’m using Moment in a project with React Native. And a specific date it does not return the correct day, all the others returns right. I put it in the index.js of the application to see if any…
-
1
votes2
answers18294
viewsHow to get the date right using momentjs
Personal talk. I’m having some trouble trying to use the momentjs library to work with dates. My problem is described below. ****--------- Datetime ----------**** Timestamp recebido do banco de…
-
1
votes2
answers3993
viewsMomentjs - How to add/subtract datetime?
Follows code: var value = '/Date(1533227866063)/'; var utc = moment().utcOffset() / 60; // -180 / 60 = -3 var datetime_utc = moment(value).format("DD/MM/YYYY HH:mm"); // 02/08/2018 13:37 var…
-
1
votes1
answer993
viewsMoment getting the value of the previous month, even after adding one month
I’m trying to work with the Moment js. var data = moment("2019-08-17", "YYYY-M-D").add('months', 1); alert(data); dia = data.date(); mes = data.month(); ano = data.year(); The alert(data) gives me…
-
1
votes1
answer1540
viewsHow to catch the start and end of the week on Moment.js
I use the following code to catch the start and end of the week. pegaData() { moment().locale(); var agora; var datainicial; var datafinal; agora = moment().format('DD-MM-YYYY'); console.log(agora);…
-
1
votes1
answer329
viewsTime formatting problem when using Moment.js and Dialogflow
I have a problem typing some time in Dialogflow for my chatbot. I know the system works with AM and PM, but I tried to format the date with Moment.js (follow the code below), but it is not working.…
-
1
votes3
answers608
viewsCustom Filtering - Range Search - Datatables
I am using one of the functions of Datatables that is interval searching, but this type of search only accepts integer numbers. I would like to make this survey accept sample date formats…
-
1
votes0
answers211
viewsIncorrect Angular Brasilian time after daylight saving time
I have an application in Angular and need to display the correct time in the system, there was no change in daylight saving time in Brazil and I am informing the time in the system one hour late.…
-
1
votes4
answers72
viewsGet minutes between two times
var dtChegada = "16:40"; var dtPartida = "11:20"; var ms = moment(dtChegada,"HH:mm").diff(moment(dtPartida,"HH:mm")); var d = moment.duration(ms); var s =…
-
1
votes2
answers261
viewsHow to validate if one date is longer than the other considering day, month and year
I need to validate if the "Current Date" is larger than the "Due Date", but it seems that Moment.js only compares the days and does not take month/year into account. var dataAtual = moment(new…
-
0
votes1
answer149
viewsDoubt Javascript Date() [front-end]
I’m building a personal blog using Github Pages and a desktop app con NWJS to do the back-end administration however I have a big question when presenting dates on the front-end. As it comes to a…
-
0
votes1
answer508
viewsWhat is the purpose of Moment.js?
I bought a new bootstrap template for my system, and it came with an included business that returns several alerts, Moment.js. From what I understand it is like a client-side validation library with…
-
0
votes1
answer216
viewsTrue return function returns false in a Vue expression
I created a method that serves to take the difference of a certain date with today’s date. With the code I put, it returns true. But when I use it within a computed value, it returns undefined. And…
-
0
votes1
answer1603
viewsHow to use Moment.js with date from an input date?
I have the following form: <form name="formConsultaPeriodo"> Data Inicial <input class="form-control dataIni" type="date" name="dataIni" ng-model="consulta.dataInicial" required /> Data…
-
0
votes1
answer909
viewsHow to use Emit and computed/watch
I am new to Vuejs and started to develop a project to study a spreadsheet launching hours and calculation of hours worked. I am using in the Laravel 5.5 project with Vuejs 2 and Momentjs to…
-
0
votes2
answers75
viewsMoment.js When working with night dates for the morning
Today I came across a problem at the time of testing the differences of hours in the library of moment.js. It works perfectly, but when I add a night job until the next day it brings me a negative…
-
0
votes1
answer69
viewsHow to subtract and add dates with javascript?
I have two dates and I need to make a delta of these dates to add in the following ones. See below: data1 = 2020-08-14T10:02 data2 = 2020-08-14T10:07 The code below brings the difference of these…
-
0
votes2
answers1554
viewsAdd hours as Moment.Js
I have a table with the following fields: However I do not want to work with date and time together, I wonder if there is the possibility of Moment.js adding only the hours, without necessarily…
-
0
votes2
answers75
viewsDoubts on how to select a week using jquery
<div class="input-group" id="DateDemo"> <input type='text' id='weeklyDatePicker' placeholder="Select Week" /> </div> $(document).ready(function(){…
-
0
votes2
answers68
viewsI can’t get the right timestamp time
I have an API I’m consuming and in it I have the field timestamp worthwhile 1604327859 and with that value I have the following time and date: This value above is correct, I am using the Moment.js…
-
-1
votes2
answers212
viewsDecrease javascript dates
I’m trying to use Moment.js but it’s bone, see?!!! I have 2 fields that return the PHP date in the dd/mm/yyyy format. I want to show in a third field the difference between these dates. For example:…
-
-1
votes1
answer808
viewsDate Today Moments.js
I’m using Moment.js with the following code, and in it is to generate the due date all month according to the selected date, but when I select today’s date, it appears written Today at 12:00 am and…
-
-1
votes1
answer279
viewsHow to calculate the current and future date and receive the difference in days
I’m using Moment.js to do date calculations, thinking about it I did this function below to make the current date calculation with the date of birth: onCalcularData(date: any): number { return…
-
-2
votes2
answers69
viewsHow to handle data passed by Answer in jQuery
Just after making a render of a screen as in the example below: ( return res.status(200).render("mschedule", { erro: {}, list: teste }) ) I would like to manipulate a return data (list) in jquery.…