momentjs Questions

4

Solved

I am working on a function that'd greet its users with a time-aware greeting (Good Morning, Afternoon, Evening, Night). Here's the script that I've made import moment from "moment"; function gene...
Psia asked 29/5, 2020 at 6:14

3

I want to test the following piece of code. I am wondering if there is a way to mock moment.js or force it to think my current location is America/New_York so that my unit test doesn't fail in gitl...
Belletrist asked 19/6, 2020 at 18:59

2

Solved

I am writing some JavaScript which uses Moment.js and Handlebars. Moment.js is supposed to be 30 KB gzipped and Handlebars is supposed to be less than 10 KB gzipped. But when I use Webpack to bundl...
Rhettrhetta asked 10/7, 2016 at 2:20

6

Solved

I'm using JSPM, AngularJS, TypeScript, SystemJS and ES6 and my project is running pretty well... unless I try to use momentJS. This is the error I get: TypeError: moment is not a function Thi...
Palaeozoic asked 8/2, 2016 at 15:9

14

Solved

I am using Moment.js and it is great. The problem I have now is that I can't figure out how to get the week of the month a certain date is. I can only find "week of year" in the Moment js docs. For...
Reyreyes asked 12/2, 2014 at 19:41

3

Solved

I am using Moment.js in my project and formatting dates as follows: var date = moment.unix(1318781876); return date.format('LLLL'); The moment docs state the multiple locales are supported. I wo...
Ol asked 8/9, 2014 at 13:52

5

Solved

I am hoping to bind the default value I generated in moment to the date and time input field. I tried ng-model and directly binding it to the value attributes. But none of it seems to work. Is ther...
Glaikit asked 28/11, 2013 at 8:57

4

Any idea why this doesn’t work or how I can extend the duration interface to support the format function? declare module 'moment' { interface Duration { format(template: string, precision?: stri...
Bruin asked 29/12, 2016 at 16:16

4

Solved

I have two inputs of time and I want to get the difference/time-interval between these two using dayjs fromtime = '13:00' totime = '17:00' So the output for the above two should be 4:00 hours I...
Mufti asked 14/2, 2020 at 12:9

5

Solved

Moment js has a function to get the number of days in a month : http://momentjs.com/docs/#/displaying/days-in-month/ However I could not find a function to find the number of iso weeks in a year ...
Terminator asked 28/8, 2013 at 3:7

4

I installed the moment.js library and was about to play around with it a little bit, when i got this error. I've tried many different things, but nothing has worked. Any ideas? I have a folder tha...
Quote asked 30/7, 2019 at 3:19

14

Solved

I try to print out date time using like the following in vue-for {{ moment().format('MMMM Do YYYY, h:mm:ss a') }} but, it does not appear. It's just a blank. How I can try to use moment in vue?
Noles asked 16/12, 2015 at 9:16

10

I would like to use Moment.js to convert a local time to UTC equivalent. I believe that I have the correct method in place, but it does not alter the time. I'm in Sydney Australian +11 and expect ...
Ambassador asked 18/3, 2015 at 5:37

2

Solved

How can I generate a list of array till today? I can't hardcode [2016,2017,2018], because I have to do it every year. function (numberOfYearsBack) { // }
Monasticism asked 28/9, 2018 at 3:50

9

Solved

I'm trying to use momentJs from typescript: depending on what module system I'm using to compile typescript, I find a different behaviour on how I can use momentJs. When compiling typescript with c...
Guard asked 7/10, 2015 at 8:24

5

Solved

Say the current time is 09:34:00 (hh:mm:ss), and I have two other times in two variables: var beforeTime = '08:34:00', afterTime = '10:34:00'; How do I use Moment.JS to check whether the curren...
Comrade asked 24/3, 2016 at 9:39

5

Solved

Basically, I want to do a myMoment >= yourMoment. There is no myMoment.isSameOrAfter and writing that out combining isSame and .isAfter is a bit lengthy. What's the alternative? Convert moment...
Tigress asked 6/12, 2014 at 0:39

3

Solved

Having some issues with calculating a date time range. What im trying to accomplish is to have moment provide me the difference in hours. For example, here is my script: var startTime = $('2016-...
Cockadoodledoo asked 21/2, 2016 at 23:7

4

Solved

I have an array of [start_time, end_time] time ranges like so: let timeSegments = []; timeSegments.push(["02:00", "07:00"]) timeSegments.push(["03:00", "04:00"]) These time segments overlap, sin...
Care asked 28/6, 2017 at 10:53

9

Solved

When testing using jasmine, I am getting this error. TypeError: moment().tz is not a function My code that I try to test is: let myDate = moment().tz(undefined, vm.timeZone).format('YYYY-MM-DD');...
Cramer asked 31/10, 2017 at 23:37

12

Solved

How can I convert seconds to HH:mm:ss? At the moment I am using the function below render: function (data){ return new Date(data*1000).toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1");; }...
Inflection asked 10/7, 2015 at 9:33

12

Solved

Following is the scenario: I have a String date and a date format which is different. Ex.: date: 2016-10-19 dateFormat: "DD-MM-YYYY". I need to check if this date is a valid date. I have tried f...
Twocolor asked 19/10, 2016 at 6:26

4

Solved

I am trying to send a mutation to my graphql server to update a date. My mutation schema looks like this: mutation CreateReminderMutation( $birthday: Date ) { createReminder( birthday: $birthda...
Antipyrine asked 25/3, 2019 at 11:36

9

Solved

I have something like /Date(1370001284000+0200)/ as timestamp. I guess it is a unix date, isn't it? How can I convert this to a date like this: 31.05.2013 13:54:44 I tried THIS converter for 13700...
Liquidation asked 7/6, 2013 at 7:15

2

Solved

I'm using Moment.js included through RequireJS. When I call Moment().month(), instead of number 11 I always get number 10. Any ideas how can this happen?
Raper asked 20/11, 2013 at 11:33

© 2022 - 2024 — McMap. All rights reserved.