Converting Java date(milliseconds) to ExtJs Javascript Date

From the Java server side, I am receiving a date in milliseconds that I need to convert into a JavaScript Date object:

long s = 1523357477; // At the Java end
var v= new Date(1523357477); //At the Javascript ExtJS end

However, the output is:

Sun Jan 18 1970 20:39:12 GMT+0530 (India Standard Time)

This is incorrect because in the ExtJS grid panel, the same date gets converted to:

10-04-2018 14:23

Below is the code snippet for the ExtJS grid columns. The key functionality lies within Ext.util.Format.dateRenderer

{
    headerId: 'column-creation-date',
    dataIndex: 'creationDate',
    text: 'Created at',
    renderer: Ext.util.Format.dateRenderer,
    width: 155,
    filter: true
}

Answer №1

There seems to be an error in the provided timestamp (in milliseconds) which is stored in MongoDB. In ExtJs, the timestamp is initially multiplied by 1000 before being converted into a date object.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Every time I attempt to navigate to the login page, I find myself stuck in an endless loop

This code snippet demonstrates the router.beforeEach function in action. It checks if the client is authenticated, and if not, it redirects them to the login page. router.beforeEach(async (to, from, next) => { if ( to.name !== 'signup' || to ...

Using AngularJS to filter JSON data

Greetings! I possess the following JSON data: $scope.Facilities= [ { Name: "-Select-", Value: 0, RegionNumber: 0 }, { Name: "Facility1", Value: 1, RegionNumber: 1 }, { Name: ...

Use JavaScript's Array.filter method to efficiently filter out duplicates without causing any UI slowdown

In a unique case I'm dealing with, certain validation logic needs to occur in the UI for specific business reasons[...]. The array could potentially contain anywhere from several tens to hundreds of thousands of items (1-400K). This frontend operation ...

using Angular and RxJS to filter out an element from an array

One of the functions in my service is a delete function. This function calls an API that returns either true or false. If the response is true, I then proceed to find the index of the item in my array, splice it out, and return the updated array. Here&apos ...

Dealing with Failed Axios Requests in React

I'm having trouble figuring out what I'm doing incorrectly. My goal is for the Main component to pass the ajax request method to the child component InputForm. The child component would then return the results, which will be stored in the state ...

What is the best way to establish a link between the index and the JSON object?

I am working with a JSON object that maintains a specific sequence within it. var sample={ "sample": [ { "example": [ { "sequence": 1, }, { "sequence":2 }, { "sequ ...

Ways to implement a worldwide change in a subordinate entity

I am facing a challenge where I need to apply a global position, obtained from a WebVR controller, to a child object that is nested within multiple parent objects with transformations. The child object I want to update does not have any transformations app ...

Checking the existence of a user's email in Node.js

Hey there! I am new here and currently learning Node.js with Express. I'm trying to find a way to check if a user's email already exists in the database. Here is what I have so far: const emailExists = user.findOne({ email: req.body.email }); if ...

You can click on the link within the Leaflet Popup to trigger JavaScript functionality

My leaflet map is functioning with GeoJSON polygons and popups attached to each one. These popups display information about the polygon. I want a link inside the popup that, when clicked, triggers a JavaScript function to retrieve and display smaller polyg ...

"Integrating an Ajax Jquery Request for fetching XML data with Django's backend is essential for seamless functionality

My goal is to retrieve the top stories from the BBC website and showcase them on an HTML web page. I initially attempted this using AJAX in JavaScript, but encountered the following error: "XMLHTTPRequest cannot load my page as no 'Access-Control-All ...

Making alterations to the HTML code of a Tumblr theme in order to eliminate specific

Here is my custom Tumblr domain URL: http://intchauhan.com/ I would like to eliminate the "Follow intchauhan" and "tumblr." buttons located on the right side. Below is the HTML of the theme: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional// ...

Steps for eliminating an element using jQuery from a variable filled with HTML code

I'm developing a forum where users have the ability to quote other users' comments. When a user clicks on "quote" for a comment, it captures the HTML of that comment and displays it in a box that says Quote: Original post by a member, similar t ...

Adjusting the Link Color with Jquery in an Unordered List Filter

I'm new to using jquery and I need help creating a filter in an unordered list with links and an input field at the top. When I type letters into the input field, I want the corresponding letters in the link items inside the li elements to change colo ...

Instructions on exporting a CSV file from a JSON array with Node.js

How can I convert a JSON array into a CSV file using Node.js? The JSON data needs to be formatted with only three columns: Column A for total number of responses, Column B for Name, and Column C for field1. Below is the code snippet I am currently using: ...

Guide on how to append input field data to a table using jQuery

My current project involves working with a table, and I have encountered some challenges along the way. Typically, I have 4 input fields where I can input data that is then sent to the table in my view. However, if I exceed 4 values and need to add more, I ...

Selecting a framework with the appropriate level of flexibility

I am currently in the process of choosing a new framework to replace our existing one for our middle-sized project. Our previous project was developed using angularJS, and our team created the core of the application which was then distributed to our clie ...

Triggering the react state update function through an onClick event

Trying to grasp React through a tutorial, but I'm confused about why I need to create a new function to pass to an JSX onClick instead of using the one returned from a React useState call directly. The following code works because it uses the handleB ...

The Bitcoin API response is coming back with a null body

I have been diving into the world of APIs and am currently working on a web application that converts cryptocurrencies to fiat currencies. However, I am facing an issue while trying to parse the JSON from the API call. Every time I attempt to do so, I enco ...

React: image appearing in DOM but failing to render on screen

As I work on developing a web application using React, my focus is on creating cards that consist of header text and an image. However, I have encountered a problem with displaying the image properly. When I import the image and attempt to use it in my co ...

Creating dynamic variable names using JavaScript and constructor: copying an image with EaselJS programmatically onto several canvases

I am facing a challenge with using dynamic variable names in JavaScript within a constructor. This task has proven to be more complex than I initially anticipated. Despite extensively researching this issue on various forums and webpages, I have not been a ...