8,150
questions
0
votes
1
answer
23
views
Get date range using moment.js
I am trying to get a Saturday to Sunday date range using moment.js.
It works up to last line and after that both start and end dates equal to end date.
Using today's date (Nov. 1, 2024), I can see ...
1
vote
1
answer
53
views
Setting moment value to specific time zone directly
We are using Moment v2.30.1. We are attempting to apply a StartDateTime to an object but it is always being set to utc(). We want to set it directly to
the America/Chicago time zone.
Here is the ...
1
vote
1
answer
60
views
How to use string time data with moment.js in Chartjs
I have an array of lap times as strings shown below:
['00:01:41.413000', '00:01:38.790000', '00:01:38.917000', '00:01:38.470000', '00:01:37.906000', '00:01:37.997000', '00:01:37.774000', '00:01:37....
0
votes
0
answers
34
views
Uncaught TypeError: Cannot read properties of undefined (reading 'fn') at moment-duration-format
I am trying to use moment-duration-format for getting duration.
https://www.npmjs.com/package/moment-duration-format
I am getting error:-
moment-duration-format.js?t=1727769487718&v=a4aab22f:155 ...
0
votes
0
answers
22
views
date issues when storing and accessing date from firebase datastore
I have an app built using Ionic angular and Google Firebase. I use fire store and store dates using the method (new Date()).getTime() from my code. One of the things I am facing is the issue when I ...
0
votes
0
answers
40
views
moment doing wrong calculations for day of the year
I am trying to find the day of the year using unix epoch and it returns 365 instead of the correct value. here is the code snippet
const momentY = moment(new Date(startDate))
startDays = momentY....
1
vote
0
answers
37
views
Vite Moment locale ignore
With webpack we used IgnorePlugin like this
const webpack = require('webpack')
module.exports = {
configureWebpack: {
plugins: [
new webpack.IgnorePlugin({
resourceRegExp: /^\.\/...
0
votes
2
answers
97
views
How to convert this "string" to a correct date?
Struggling to display a date in javascript that is retrieved from a postgres database and returned via python.
When I simply console.log the variable I get back from my GET request, it is in this ...
-1
votes
1
answer
54
views
Could not resolve require("./locale/**/*")
I am using Vite+React. I am getting error while running npm run dev.
"[ERROR] Could not resolve require("./locale/**/*")
node_modules/moment-with-locales-es6/node_modules/moment/min/...
0
votes
2
answers
66
views
Convert moment time to milliseconds
I want to convert moment time to milliseconds.
I have next code:
const moment = require("moment")
const countdown = "00:02:32"
const millis = moment(countdown, "hh:mm:ss"...
0
votes
1
answer
24
views
Count and check difference in timer countdown
I have timer countdown which starts from for example 04:00 (minutes:seconds).
And I want to check that timer is in diapason of 10 seconds.
I understand that need to convert time string to time and ...
0
votes
2
answers
39
views
using momentjs to fetch data from backend
I am trying to fetch data from the backend that has the trip status set to "upcoming"
but I want to conditionally fetch it using my current time. It should only fetch data that is max 15 ...
0
votes
1
answer
55
views
Change date with button (prev-next) from calendar using only moment library
I want the date to change month when the prev and next buttons are clicked.
The following code is working, as you can see.
It just seems like dirty code to me.
document.getElementById('nextdate')....
0
votes
0
answers
18
views
How to disable DateTimePicker Options Based on Multiple time interval Selection?
I have a workHours Object where each day can have multiple work time like this
monday: {
active: true,
hours: [
{ from: '09:00', to: '12:00' },
{ from: '17:00', to: '23:30' }
...
0
votes
0
answers
42
views
Issue with Sorting French Dates in DataTables
I'm working on a React application using DataTables to display data. I'm using two additional plugins: one for French language support and another for date sorting (ultimate-datetime-sorting). The ...
0
votes
3
answers
111
views
Why does moment.startOf go back 1 hour?
Edit: My local timezone is UTC+1
I have this date string: 2024-07-01T00:00:00.000Z.
This date string has a 'Z' at the end which denotes that it is in UTC (If I understand correctly).
When I run
...
0
votes
1
answer
90
views
MomentJS - Create An ISO 8601 Datetime String In UTC Using Date, Time, And Timezone Variables
I have three separate variables I want to use to construct an ISO 8601 datetime string in UTC (without offsets). The three variables are:
Date (in 2024-7-31 format)
Time (in 14:00 format)
Timezone (...
0
votes
0
answers
30
views
Issue with Date Handling in Node.js and MySQL: Date Reduced by One Day
I'm experiencing an issue with date handling in my Node.js and MySQL application where the date stored in the database is correct, but when retrieved via an API, it is reduced by one day. Here are the ...
0
votes
0
answers
73
views
moment.tz not defiend on home page
I've tried to read everywhere and asked chatgpt but i cant find a solution.
i created this plugin here and its working fine via the following page https://nourhammoury.com/
However, on this home page, ...
3
votes
2
answers
112
views
year calculation issue using moment library when setting age as a number
I am asking end user to put numerical age of the user. For example user inputs 31.
Behind the scene I convert this to the year and store it. The logic is below to convert:
(moment().subtract(age, '...
6
votes
2
answers
2k
views
Using moment with Angular 18
After upgrading to Angular 18 I get following error when using moment.
Calling "moment" will crash at run-time because it's an import namespace object, not a function
My import statement ...
2
votes
2
answers
66
views
Moment JS isBetween Not Working as Expected on Date Objects
I have a Date object and I want to check if it's tomorrow.
const dateToCheck: Date //Sat Jun 01 2024 09:00:00 GMT-0700
I calculated tomorrow like this:
const tomorrow = moment().add(1, 'day')
The ...
0
votes
2
answers
74
views
sort array in a date string property, using lodash or moment() or simple javascript
this is my test array:
let testArray = [{'Datum':'13/05/2024','ID':1},
{'Datum':'18/05/2013','ID':2},{'Datum':'01/05/2018','ID':3},
{'Datum':'31/05/2024','ID':4},{'Datum':'31/05/2024','ID':5}]
trying ...
0
votes
0
answers
59
views
JS script to validate date in between 2 dates gives error if end date is different month
I'm trying to develop a script for Flokzu (A BPMN software that uses js scripts to define form field validations) and i'm asked to validate vacation days request fields. E.g. start date is after today ...
0
votes
0
answers
38
views
How can I delete time from date in moment().calendar()?
I am trying to get Today and Tomorrow titles from date using Moment Calendar.
In case moment(date).calendar() I get Tomorrow at 12:00 AM. But I need without time. Just Tomorrow
In case moment(date)....
1
vote
1
answer
106
views
Moment JS use in client only standard time regardless of the timezone
"angular": "12.2.0"
"moment": "^2.30.1"
"moment-timezone": "^0.5.44"
The project is a calendar scheduler.
Backend: C# sends UTC timestamp;
...
0
votes
0
answers
63
views
Moment Time zone Africa/Cairo giving me +2 instead of +3
Recently time zone of Egypt time zone is updated to +3 but library still getting +2 time zone. Iam using 2.29.3 version
I tried several libraries but no library is giving me the updated timezone (I ...
0
votes
0
answers
63
views
react-big-calendar onSelectSlot returns last day of the week only in production
I am using react-big-calendar and when i select a empty slot using onSelectSlot it return the the end date in calendar.for eg: if the visible dates are from sunday to saturday it always return ...
0
votes
1
answer
63
views
MomentJS Date format returning strange value [closed]
I have a date string as below i.e. startDate = "02-05-2024"
Now, I want this date to be formatted in the below format (to return as string to some API endpoint)
YYYY-MM-DDTHH:mm:ss.SSS[Z]
I ...
0
votes
0
answers
40
views
Warning when using moment-with-locales
../../../../node_modules/moment/min/moment-with-locales.min.js
Module not found: Can't resolve './locale' in 'C:\Users\arnav\node_modules\moment\min'
Import trace for requested module:
../../../../...
-1
votes
1
answer
266
views
moment.js not defined in odoo module
while i try to use moment in odoo module it through some error like this :
The following modules are needed by other modules but have not been defined, they may not be present in the correct asset ...
-1
votes
2
answers
78
views
What is the best way to round-trip dates to Javascript in server's time zone?
I have a datetime stored in a database on a server that represents the start of a performance.
We can assume that the time zone in the location of the performance is the same as the web server and ...
0
votes
0
answers
47
views
Why is this bringing back a filled array?
I am trying to find out what venues are opened at present using a filter, the thing works well when the time is in between and after the time is not. Then come late night and everything changes.
I am ...
1
vote
1
answer
61
views
Moment not giving same values
var a = moment().toISOString(true)
var b = moment();
var c = moment(b.toISOString(true));
console.log(a);// 2024-04-15T00:09:47.226+01:00 --->here time is one hour ahead
console.log(b);//"2024-...
0
votes
1
answer
78
views
moment.js returning random date and utc time
I am using Moment.js in a project to process date & time entered by user, and every time it returns a random date along with UTC time. Below is the code for extracting values into variables:
const ...
0
votes
0
answers
32
views
DateTimePicker not working, textField not updating with selected hours and minutes
I am developing a custom DatePicker using the moment.js library in React. However, I have noticed that the value of my TextField is not updated when I select a new hour and minute in the DatePicker.
...
0
votes
1
answer
53
views
Getting a wrong value while converting date from german locale to english using moment
All I want is to get the date value received in german language to english format for which i tried using moment library as given below
It does convert but unfortunately returns a wrong value.
moment('...
1
vote
1
answer
39
views
Invalid date shown in MySQL table when handling times and strings
I have a data table that is storing a variety of dates and times and a string. The dates function perfectly, but the times and string are displayed as invalid time. Why does this happen?
here is an ...
-2
votes
4
answers
92
views
Using moment to calculate time difference
I am using below logic to calculate the time difference.
However, this is giving wrong result value when days > 1.
Please help simplifying the code.
I will be using the time difference logic in ...
1
vote
0
answers
109
views
How to get list to time zone abbreviations in JavaScript?
I'm writing a date-related logic where the timezone name is important. The user enters the time whatever they want and the timestamp then gets converted to the timezone mentioned internally in a ...
-1
votes
1
answer
56
views
Best practices for handling time zone conversions in a multi-time zone software application using Node.js [closed]
In multi-time zone software applications where the server operates in UTC time and users register from different time zones, what are the recommended best practices for handling time zone conversions ...
0
votes
1
answer
101
views
Timezone Discrepancy in Discord.js Bot between Localhost and Hosting Environments
I have a Discord.js bot that retrieves prayer times using an external API and sets reminders for these times. The bot works fine on my localhost, where the timezone is set to Cairo, Egypt on the ...
1
vote
2
answers
45
views
Event Date Input Displays Incorrect Date When Local Timezone Changed to US-based
When I change my local timezone to a US-based one, the event date does not work properly. It does not display the selected date in the event date input; instead, it displays the previous date. (For ...
0
votes
1
answer
489
views
MomentAdapter.js throwing a date.isUtc is not a function
I'm passing a date as an initial value for the MUI DatePicker, but I'm receiving the following error:
value.isUTC is not a function
./node_modules/@mui/x-date-pickers/AdapterMoment/AdapterMoment.js/...
-1
votes
1
answer
33
views
Convert UTC time to local time in nodejs while creating csv
When I convert utc time to local time its working in my local machine but when i deployed it on server then getting me UTC time only means it does not convert time into local. I have tried with moment ...
0
votes
0
answers
181
views
Set Min and Max dates for Datatables Datepicker to use
I'm hoping this is a very simple request and I'm just missing something obvious.
I'm using the DataTables DatePicker to allow a Date Range search and whilst it's working exactly as it should, I really ...
0
votes
0
answers
41
views
V-Calendar from vuetify don´t load my Events
i want to create a Vuetify-Calendar in my Vue.js-Application.
This is how my calendar looks:
<v-calendar
class="mt-5 mb-5 rounded-xl"
v-model="focus"
...
0
votes
0
answers
32
views
How to parse moment.duration with multiple formats
I have the following input formats of the time
const formats = ['m:ss', 'mm:ss', 'H:mm:ss', 'HH:mm:ss'];
and I need to extract the number of seconds using moment.js.
I tried this:
const myMoment = ...
4
votes
2
answers
8k
views
Angular patchValue vs setValue and dates
Is there any significant difference between using patchValue or setValue to set the value on a form ?
Also is there any difference or best practice regarding using moment or date obj ?
if(...
0
votes
1
answer
223
views
Get time zone information from a date in nodeJS or momentJS
We have a current time called 11:10 PM as the string value. We will create a date object with this time. Now from this date can we get the timezone for this date value?
We are expecting the timezone ...