Skip to content
Advertisement

Tag: momentjs

Moment date conversion from datepicker format problem

I have a problem with converting date time which comes from datepicker to moment (I use this library) time format. What I get from datepicker: 2021-01-30T07:00:00.000Z The code that I used via moment: Output I get with this implementation: Fri Apr 30 2021 00:00:00 GMT-0700 (Mountain Standard Time) What I expected: Fri Apr 30 2021 07:00:00 GMT-0700 (Mountain Standard Time)

Formatting ISO time with Luxon

Using Luxon JS, I’ve been trying to format datetime to output in a certain format, using the native toISO function: This is what I get: And this is what I want: I know that they are both equivalent in terms of unix time and mean the same thing except in a different format, I just want to be able to

Disable Weekends on ng2-date-picker

I am looking for a function that can disable weekends on my datepicker. I know that I can use isDayDisabledCallback to disable dates but how can I only disable weekends. Answer In the configuration you can set the callback isDayDisabledCallback like that for exclude Saturday and Sunday.

How to generate momentjs format from custom time object

Context: Hi, I am trying to generate a moment.js format from the given start time and end time. Using the above endTime property I am trying to get time in the format below : 2021-02-04T09:00 pm i.e This format https://momentjs.com/docs/#/displaying/format/ – “YYYY-MM-DDThh:mm a” using this piece of code Where I am adding the current date and end time in a

Make time independent of browser time zone

i am printing a timestamp in console of chrome browser using following code, this line prints the timestamp at given time and date. if i change timezone from “windows Date and time settings” , the output of above line also changes . how can i make output of above line constant irrespective of timezone of current browser window ? Answer

Vuetify tooltip refresh/rerender on hover

I have a vuetify tooltip component. In the tooltip I have a {{date | moment}}. I get a static a few seconds ago. I want every time I hover over the button, to refresh the button tooltip to the current elapsed time (10 minutes ago for example). I can’t figure out how to rerender the tooltip on hover with the

moment.js error, sometimes ignores the day

I have a problem with moment.js and it’s that I have two dates (initial and final) when I initialize the dates, the initial is fine but the final date is not, moment.js ignores the day part of the date ,I set “2020-10-05T09:00” but in the console I get “2020-10T17:15Z”, as you can see it doesn’t have the day part. Here

Generate an array of dates and year using moment js

I have this code : I want to get something like : Have you an idea about that. My function is not working properly. Answer You can not declare such array structure, but you could use Object where keys would be years and values would be arrays of strings. Therefore I would propose such code which will create a year

Advertisement