momentjs Questions

3

Solved

I'm trying to get the next business day with my code, but it's not working correctly. It's just showing the next day. I've tried to check other questions to find the error, but I still can't figure...
Discommodity asked 17/7, 2015 at 13:20

5

Solved

My application has an HTML form with some inputs populated from the backend and other inputs being entered by the user (in a time input). An onChange function runs through each input when the user ...
Apologetic asked 6/4, 2016 at 16:38

9

Solved

What is the best way to get client's timezone and convert it to some other timezone when using moment.js and moment-timezone.js I want to find out what is clients timezone and later convert his da...

2

I have a simple system, which on node creation form, allows user to select start and end dates along with hours and minutes: The problem is that the date gets messed up somewhere in the middle, or...
Dani asked 14/8, 2019 at 19:19

2

I was recently using momentjs but just switched to dayjs. However, I need to get a list of timezones. With momentjs it was pretty simple : moment.tz().names() , but with dayjs I can't figure out ho...
Hendrix asked 26/8, 2022 at 7:16

3

Solved

I need to test an input for proper date format. I want to accept several date formats so I created a validating function that test if at least one of the formats is OK and in that case return true....
Volgograd asked 16/6, 2017 at 9:31

9

Solved

I'm setting a default follow-up date two days from current date, which currently works: const Notify = moment().add(2, 'days').toDate(); However, I would like to exclude weekends. So I installed...
Flamingo asked 20/9, 2018 at 14:59

18

Solved

I'm able to get the difference between two dates using MomentJs as follows: moment(end.diff(startTime)).format("m[m] s[s]") However, I also want to display the hour when applicable (only when >=...
Snowman asked 6/8, 2014 at 0:39

5

Solved

I'm new to Vuejs. Made something, but I don't know it's the simple / right way. what I want I want some dates in an array and update them on a event. First I tried Vue.set, but it dind't work out...
Willis asked 15/3, 2017 at 11:2

7

This is my code that is deployed on Parse.com CloudCode : var now = new Date() var then = moment(now).subtract(20, "minutes").toDate() console.log(now) console.log(then) Why does now === then ?...
Humes asked 21/1, 2016 at 16:25

2

I'm trying to use "moment-duration-formation" in TypeScript but, even though it works, webpack keeps on complaining that it can't find the "format" method on the line: return moment.duration(value...
Epispastic asked 19/10, 2017 at 19:58

9

Solved

I need to group a bunch of items in my web app by date created. Each item has an exact timestamp, e.g. 1417628530199. I'm using Moment.js and its "time from now" feature to convert these raw times...
Cotenant asked 5/12, 2014 at 20:2

16

Solved

I have a unix timestamp, and I'm trying to convert it into a calendar date such as MM/DD/YYYY. So far, I have this: $(document).ready(function() { var value = $("#unixtime").val(); //this retrie...
Vuong asked 6/1, 2014 at 4:38

2

Solved

I'm using DatePicker component from antd inside a form and want to change the default onChange and value of props in DatePicker but it is not working. <Form.Item label='Test Label' name='start...
Foursquare asked 23/3, 2022 at 22:12

8

Solved

I have a date object that's created by the user, with the timezone filled in by the browser, like so: var date = new Date(2011, 05, 07, 04, 0, 0); > Tue Jun 07 2011 04:00:00 GMT+1000 (E. Austra...
Macarthur asked 28/6, 2015 at 4:23

5

Solved

I am trying to get moment to work in my angular application. Here is a clean sample repo to demonstrate the issue. Clone that repo and run ng build test-library in the root directory. Install packa...
Fluorspar asked 8/3, 2019 at 20:36

10

Solved

I'm using moment.js to format my date time, here I have two date values, and I want to achieve a particular function when one date is greater than the other. I read most of their docs, but didn't f...
Transfigure asked 24/3, 2014 at 4:1

30

Solved

I'm using moment.js to do most of my date logic in a helper file for my React components but I haven't been able to figure out how to mock a date in Jest a la sinon.useFakeTimers(). The Jest docs o...
Dampier asked 18/4, 2015 at 16:3

4

Solved

Why does moment.js UTC always show the wrong date. For example from chrome's developer console: moment(('07-18-2013')).utc().format("YYYY-MM-DD").toString() // or moment.utc(new Date('07-18-2013')...
Throughcomposed asked 25/7, 2013 at 10:44

4

Solved

For example, the difference in Eastern and Central is 1. My solution below feels hacky. Is there a easier / better way? var diff = (parseInt(moment().tz("America/New_York").format("ZZ")) - parseIn...
Gillis asked 25/3, 2015 at 20:0

6

Solved

I have a form where a user can submit some info needed One of the fields is a Date of Birth I am using react-datepicker package for that specific field A piece of code looks like this: <lab...
Tea asked 11/10, 2018 at 12:18

24

Solved

I am trying to change the language of the date which is being set by moment.js. The default one is English, but I want to set the German language. These is what I tried: var now = moment().format(...
Pinkham asked 5/7, 2013 at 16:28

3

Solved

I tried to use the luxon library to move away from moment - to translate the 1615065599.426264 timestamp into an ISO date. According to the Online Epoch Converter this corresponds to GMT: Saturday...
Nels asked 9/3, 2021 at 19:27

8

Solved

Is there any way you can stop moment.js from loading all the locales (I just need English) when you're using webpack? I'm looking at the source and it seems that if hasModule is defined, which it i...
Topee asked 19/8, 2014 at 13:13

8

Solved

I'm creating a calendar where I print out weeks in a tabular format. One requirement is that I be able to start the weeks either on Monday or Sunday, as per some user option. I'm having a hard time...
Hippopotamus asked 18/9, 2013 at 14:56

© 2022 - 2024 — McMap. All rights reserved.