All Questions
Tagged with date javascript
11,226 questions
0
votes
6
answers
129
views
Remove Leading 0s from Date Formatted mm/dd/yyyy
I have a date formatted like such:
04/09/2024 10:45
I am trying to remove leading zeros when they exist in the month and day. I have been trying to do this with regex but am struggling to get the ...
0
votes
0
answers
24
views
EXIF date from image returns 01/01/1601 00:49 for just one user
private processImage(fileSelected: File): Promise<{ url: string, gpsIncluded: boolean, fiveSecondLimit: boolean }> {
return new Promise((resolve, reject) => {
let reader = ...
5
votes
1
answer
247
views
Show and hide divs based on date
I'm trying to show hide divs based on date and am experimenting with the following code:
I would like to show the div between two dates, and I like to create multiple divs to show at different days of ...
0
votes
0
answers
29
views
is there a builtin date function that will give an error on an non-existing date? [duplicate]
I'm new to javascript. I'm trying to validate a date and find that the code below, when given feb 31 returns mar 2. Why is it "fixing" the date instead of returning an error? Is there not a ...
0
votes
1
answer
59
views
Convert current date to an Uint8 array of bytes in little endian format
I'm trying to convert the current date to an Uint8 array of bytes in little endian format.
What I tried is this :
const epochSeconds = new Date().valueOf();
This works and returns the current date in ...
0
votes
0
answers
76
views
Maintain Timezone Information from `Date()` when calling `Date().toString()` in Javascript
I am trying to pass the user's local time to my backend. Any calls to instances of Date() (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) seem to lose the ...
0
votes
1
answer
113
views
DateTime Format using Intl in es-AR return date without am/pm
There is a very strange behavior of Intl.DateTimeFormat in case of 'es-AR' local when I try to format date for example :
const date = Date.UTC(2012, 1, 2, 14, 5, 42);
let format: Intl....
-1
votes
1
answer
73
views
How to make a date input match a certain day of the week?
I have an HTML script with date inputs for each day of the week (Sunday-Saturday). I'd like to validate the inputs so that the user can only select dates which match that day of the week. For example, ...
0
votes
2
answers
57
views
Days elapsed since dates given, with time offset from multiple international dates
I have several dates/times that I need to display, in local time - but I'd also like to have the time elapsed in days/hours for each date:
2024-11-22 04:03:59 (4 days 17 hours ago)
The data I have ...
-1
votes
1
answer
34
views
Error displaying createAt Date in NextJs from Mongo
When I try to log the whole MongoDb table, it logs everything in it. However, when I try to log user.createdAt separately, it logs undefined.
When i use user.createdAt.toString() it shows an error (...
-2
votes
1
answer
72
views
How to calculate next's month date without knowing the client's timezone?
Dates are really weird, and I can't seem to solve this issue:
Client lives in GMT+2 time zone and server saves everything in UTC time zone.
Client provides date 2024-12-01 which is converted to UTC ...
1
vote
1
answer
96
views
How to trigger inline script onload?
I have the following script, as seen, it calls the Date method onClick event, like so:
<!DOCTYPE html>
<html>
<body>
<p onclick='this.innerHTML = Date();'>click me!</...
-3
votes
2
answers
59
views
Javascript add days to a date [closed]
I need to visualize a div containing all 30 days after the current one. But when javascript add a day after 1 december 2024 the result is 1 january 2025.
This is the code
var ldate = new Date();
...
0
votes
1
answer
47
views
Google Annotation chart Invalid date, or date and time error
I am having problem in formatting the date column for Google Annotation chart. I am following this link https://developers.google.com/chart/interactive/docs/gallery/annotationchart
My Data for ...
0
votes
1
answer
51
views
Issues with javascript dates /times on server vs local browser (react)
I have a set of code running that checks two dates. If those two dates/times occurred on the same day, one course of action is taken. If they are not, a different set of components are shown. The code ...