I receive a datetime string with different timezones (for example '2020-10-28T08:00:00+10:00, 2020-10-28T11:00:00+11:00'). When I create new date object, it converts the string to the current User timezone, displaying different date and time on UI rather than showing what is being received. How to stop timezone conversion?
How to stop conversion of the timezone on new date object in javascript lwc?
1.1k Views Asked by Kanikala At
1
There are 1 best solutions below
Related Questions in JAVASCRIPT
- Angular Show All When No Filter Is Supplied
- Why does a function show up as not defined
- I count the time the user takes to solve my quiz using Javascript but I want the same time displayed on another page
- Set "More" "Less" font size
- Using pagination on a table in AngularJS
- How to sort these using Javascript or Jquery Most effectively
- how to fill out the table with next values in array with one button
- State with different subviews
- Ajax jQuery firing multiple time display event for the same result
- Getting and passing MVC Model data to AngularJS controller
- Disable variable in eval
- javascript nested loops waiting for user input
- .hover() seems to overwrite .click()
- How to sort a multi-dimensional array by the second array in descending order?
- How do I find the fonts that are not loading in a CORS situation ( MoovWeb )?
Related Questions in DATETIME
- Python datetime.now() with timezone
- Create a list of sequential monthly dates in PHP given initial date and quantity
- DataTable RowFilter on Time component of DateTime column
- Joda DateTime Json date format issue
- how to create folder and file with datetime in wpf application
- String concatenation with padded integers
- What is the correct DateTime format in WebSQL to perform date comparison queries?
- how to get the time interval of a date and a datetime displayed as day,hour, min,seconds in sql
- DateTime.Now.ToString("HH:MM") allways gives 20:06
- How can I get the ctime and/or mtime of a file in Python including timezone?
- add time (char(8)) to date column
- MyBatis cannot work with joda DateTime?
- PHP Fatal error: Call to a member function format() on boolean
- Use DateTime format in a class but restrict time tokens
- Modify records to account for correct priority and order between two systems
Related Questions in TIMEZONE
- Python datetime.now() with timezone
- How to set timezone to the local in Rails?
- keep timezone "CET" from convert into "CEST" in python
- Golang time zone parsing not returning the correct zone on ubuntu server
- How to check server timezone
- How can I get the ctime and/or mtime of a file in Python including timezone?
- DateTimeOffset parse and custom time zone
- How to use Standard Time Only in TimezoneInfo.ConvertTime C#
- Are TimeZoneInfo.Id indexes are always the same?
- Older dates are parsed as summer time, even if that is not true in Java
- Can't set timezone using abbreviation
- Converting an ISO 8601 string to Current TimeZone DateTime Object in Javascript
- Ruby: Time.parse() Incorrectly Returning Alaskan Timezone
- Pandas date time formatting with timezone shifting
- What is a good practice when we need to work with datetime
Related Questions in LWC
- What does the below snippet mean?
- Highcharts : Mouse Over on Legend throwing error in LWC Component
- custom carousel in LWC
- Is there a way to change a font color in Lightning input rich text field when maximum character limit is exceeded in LWC JS?
- How to stop conversion of the timezone on new date object in javascript lwc?
- How to removed canvas element event listeners
- Salesforce LWC FullCalendar V5 Initialization Issue
- Undefined when Passing pre defined Values from lwc to controller
- console log a reactive prop in lwc
- is it possible to use lwc properties in Salesforce experience cloud components like Rich Content Editor
- Onload apex imperative method returns nothing in js constructor() but on second refresh it returns the proper data, why this is happening in LWC?
- Salesforce apex class, unable for deploy for this organization
- Custom Multi Lookup LWC - Refresh Page After Record Edit -> Save
- Salesforce lwc onclik function not running
- Salesforce LWC: Not able to create record and not getting any error as well
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
If LWC uses the JavaScript
Dateobject, then sorry - but there's nothing you can do. The behavior you described is how theDateobject works.The
Dateobject internally tracks only a timestamp which is the number of milliseconds since the Unix epoch: 1970-01-01T00:00:00.000Z (UTC). If you parse a string with an offset, that offset is considered when determining the timestamp. If you create a string withtoString(), it uses the system local time zone to convert the timestamp to a string. The original string you parsed, or its offset, is not retained in theDateobject.I don't know much about LWC, but in general you can only solve this by not using a
Dateobject, and using something else instead. There are many good JavaScript date libraries to pick from, such as Luxon.