momentjs Questions
9
Solved
I'm using Moment.js to parse and format dates in my web app. As part of a JSON object, my backend server sends dates as a number of milliseconds from the UTC epoch (Unix offset).
Parsing dates in ...
Hendrika asked 11/3, 2013 at 20:5
3
I know this question has been asked multiple times.
But I could not find the correct one for my case.
I would like to mock the moment() to return a specific date.
First, I mock by
jest.mock("m...
Made asked 1/7, 2021 at 11:5
4
Solved
What do I want to achieve?
I want my Angular Material(v11) datepicker to use the DD-MM-YYYY format in an Angular version 11 project.
What have I tried?
I tried using the MatMomentDateModule but thi...
Sideburns asked 5/1, 2021 at 14:46
18
Solved
formatCalendarDate = function (dateTime) {
return moment.utc(dateTime).format('LLL');
};
It displays: "28 februari 2013 09:24"
But I would like to remove the time at the end. How can I do that?...
Cowling asked 28/2, 2013 at 8:25
5
Solved
I'm in the process of converting a website to use TypeScript and I'm converting just one of many JavaScript files to TypeScript.
All pages of my site already reference moment.js, such as:
<scri...
Carlisle asked 14/2, 2017 at 18:56
3
Solved
I'm trying to convert a date string to epoch, then epoch back to the date string to verify that I'm providing the correct date string.
var epoch = moment("10/15/2014 9:00").unix(); // do I need to...
Psittacosis asked 15/10, 2014 at 21:18
1
I want to update several records with the same time, and I can't figure out how to do it.
I've tried various combos with pg-promise and moment and node alone:
myTs = Date();
myTs = moment(new Dat...
Criticaster asked 15/11, 2018 at 23:36
6
Solved
I have this backend that sends me a pre formatted time in a set time zone, but without any information for the said time zone. The strings are like: "2013-08-26 16:55:00".
I can create a new momen...
Longinus asked 26/8, 2013 at 16:8
15
Probably and easy answer to this but I can't seem to find a way to get moment.js to return a UTC date time in milliseconds. Here is what I am doing:
var date = $("#txt-date").val(),
expires = mom...
War asked 25/4, 2014 at 17:59
2
Solved
I have the following code :
var fomattedDate = moment(myDate).format("L");
Sometimes moment(myDate).format("L") returns "Invalid date", I want to know if there is a way to prevent that and retur...
Demolition asked 11/3, 2015 at 17:14
13
Solved
I have a date object that I want to
remove the miliseconds/or set to 0
remove the seconds/or set to 0
Convert to ISO string
For example:
var date = new Date();
//Wed Mar 02 2016 16:54:13 GMT-...
Counterrevolution asked 2/3, 2016 at 21:58
3
My old code use momentjs, something like this :
moment(createdAt, 'YYYY-MM-DD HH:mm:ss').toISOString()
What is the equivalent method on date-fns that will reproduce same result ?
Mask asked 27/8, 2018 at 6:46
6
Solved
I get incorrect results when trying to find numeric difference between two dates:
var startDate = moment( $('[name="date-start"]').val(), "DD.MM.YYYY"), // $('[name="date-s...
Danas asked 13/4, 2016 at 13:57
7
Solved
How to get the first and last visible date in React Big Calendar? This will facilitate database queries to view events. I'm trying to call the onNavigate () function and get start and end using the...
Schleswig asked 2/9, 2019 at 9:43
14
Solved
I have two time without date
var startTime="12:16:59 am";
var endTime="06:12:07 pm";
I want to show the total hours in between the above times by using moment.js.
If it's not possible in moment...
Blanks asked 20/4, 2015 at 10:53
3
Solved
I work with moment.js and I have 3 different dates, e.g.
30.07.2018
12.06.2018
10.05.2018
I now try to get the difference in days from these dates until today (if it is less then 7 days ago) or...
Nash asked 1/8, 2018 at 21:39
6
Solved
I want to stote dates in my state using redux-form. I use react-datepicker. To make the datepicker compatible with my redux-form i write:
import React, { PropTypes } from 'react';
import DatePicke...
Sailfish asked 8/3, 2017 at 8:12
6
Solved
I'm trying to utilize the momentjs library in Google Apps Script but I'm not clear on how to do so. I'm not sure how to add the library, so obviously running something like the following results in...
Gallant asked 14/3, 2014 at 16:6
11
I'm trying to convert UTC time to the local time. I've been following this example from this link: http://jsfiddle.net/FLhpq/4/light/. I can't seem to get the right local output. For example, if it...
Burgener asked 12/9, 2015 at 15:43
8
Solved
I have for instance this datetime:
01:20:00 06-26-2014
and I want to subtract a time like this:
00:03:15
after that I'd like to format the result like this:
3 hours and 15 minutes earlier.
...
Daric asked 26/6, 2014 at 10:57
7
This is my ISO formatted date. In here I want to get time like "11:00" by JavaScript.
I used this method:
new Date(Mydate).toLocaleString();
But it gave time as "16:30". Is the...
Treva asked 11/12, 2013 at 11:57
6
Solved
I was trying to use z or zz in format to display the timezone at the end of the string and found that it's deprecated. Z and ZZ work to display -0700, but instead I want it to show PDT.
I got mome...
Globin asked 12/6, 2014 at 0:35
5
Solved
What is the easiest equivalent of date.setHours(0,0,0,0) when using moment.js?
Basically, if I need a new Date() moment with hours, minutes, seconds, and milliseconds zeroed out.
Mehala asked 18/2, 2015 at 19:28
9
I'm unable to mock moment() or moment().format functions. I have states where, currentDateMoment and currentDateFormatted are getting set as below.
currentDateMoment: moment() //2019-04-23T17:45:26...
Marna asked 24/4, 2019 at 21:26
5
Solved
Is there any better way for getting only day and month from a date including location appropriate separator?
I have a solution that gets separator first:
function getDateSep() {
var temp = mo...
Propagate asked 24/2, 2017 at 11:15
© 2022 - 2024 — McMap. All rights reserved.