Questions tagged [toisostring]

25 questions
21
votes
3 answers

Why converting new.Date() .toISOString() changes the time?

I'm inserting a date in a database in two different format. this is inserting as Datetime var mydate; mydate = new Date(); document.getElementById('clockinhour').value = mydate.toISOString().slice(0, 19).replace('T', ' '); Output…
Sebastian Farham
  • 797
  • 2
  • 8
  • 24
1
vote
1 answer

Date format acting strange in redux devtools

I'm working with an existing codebase, and the existing code calls for a date from an endpoint. The expected value is an ISO string (i.e. "2020-01-09T07:41:02.6025984-05:00"): // in my sagas: export function* handleGetServerTime(): Generator { …
Seth Lutske
  • 3,942
  • 2
  • 7
  • 31
1
vote
2 answers

Locale time on IONIC2 Datetime picker

I'm working with IONIC2, Angular2 and Typescript. I have an Datetime working as follows: page.html page.ts date: string = new…
Samuel Fraga Mateos
  • 523
  • 1
  • 6
  • 20
1
vote
1 answer

How to resolve loss of minute precision formatting a moment in 12HR?

I've converted an ISO date string to a momentjs moment and then formatted that moment using .format("MM/DD/YYYY HH:MM"). When I output the final formatted moment, the minute value is incorrect as against the value read back from the iso string…
Brian J
  • 5,416
  • 19
  • 94
  • 189
0
votes
1 answer

Save IsoString with offset to database

Currently I have an app in development that would pull some data in Amazon selling partner api. My goal is to replicate the reporting from Amazon's seller dashboard. Currently the account is is Eu region using Europe/Berlin timezone. I need to…
rai
  • 137
  • 7
0
votes
0 answers

I am getting an error when transforming datetime javascript

I'm using date.toISOString() to use DateTime format "yyyy-MM-dd'T'HH: mm: ss'Z '", I must use ISO 8601 format. At the time of transformation, the time is showing it 5 hours in advance, that is, I am receiving for example this hour 2020-12-03…
0
votes
0 answers

Angular App Error when trying to use XLSX.writeBuffer()

I'm getting a mysterious error when trying to use the xlsx.writeBuffer() method in my Angular app to try and download an Excel file to the client browser. After finishing all the changes that needed to be made to the workbook, I try to download it…
A. Lewis
  • 37
  • 5
0
votes
2 answers

toISOString() is subtracting day from value

I have this date format: Tue Oct 20 2020 00:00:00 GMT+0100 (Central European Standard Time) And when I do : myValue.toISOString(); that's what I get 2020-10-19T23:00:00.000Z It's subtracting a day. How can I solve this without changing date format?
Nour May
  • 1
  • 3
0
votes
0 answers

Parse ISO String into Date Swift

I'm trying to parse the following string into a date: "2020-07-03T16:07:11.450Z" using the following code: let formatter = ISO8601DateFormatter() let expiryDate = formatter.date(from: accessTokenISODate) however this returns null. I obtained…
Alk
  • 4,240
  • 7
  • 30
  • 82
0
votes
2 answers

Get the local date instead of UTC

The following script calculates me next Friday and next Sunday date. The problem : the use of .toISOString uses UTC time. I need to change with something that outputs local time. I'm very new to javascript so I can't find the right property to use…
Francesco
  • 61
  • 5
0
votes
2 answers

Compare two IsoString date in javascript

I want to compare two Iso string dates by days, date have this format : ** "2020-05-07T15:51:28.124Z" ** I made this function to get the result of comparison by days : compareDatesByDays(higherDate, lowerDate) { const diffTime =…
sahnoun
  • 944
  • 2
  • 22
  • 39
0
votes
1 answer

JavaScript Date toISOString returns unexpected result before April 3rd, 1978

When I try the following code in my JS console, it returns the right UTC notation (-2 hours): new Date('1978/04/03').toISOString() -> "1978-04-02T22:00:00.000Z" However, starting from April 2nd and earlier, it shows a different behaviour: it will…
Edwin
  • 566
  • 7
  • 17
0
votes
1 answer

javascript Date.toISOString() return difference date value

I'm confusing about the javascript Date.toISOString() function which shown as below example, how come date value of x in ISO format become January? const date = new Date(); const x = (new Date(date.getFullYear(), date.getMonth() ,…
jian
  • 13
  • 3
0
votes
2 answers

convert string to ISO date time in nodejs

Convert this date into ISO format in nodejs created_at="September 17th 2019, 16:50:17.000"; let new_time = new Date(created_at); created_at = new_time.toISOString(); console.log(created_at); Output: Invalid Date Exacting…
malik
  • 31
  • 8
0
votes
1 answer

How to set minimun date and time in ionic 3

I want to set min date and time to ion-datetime. But I am not able to set it without converting that to toISOString(). If I am converting to toISOString() then time is not setting the exact time. It is setting the 5.30 hr previous time. …
ananya
  • 861
  • 4
  • 24
  • 44
1
2