Combine a segment from two arrays into a single array

I have two arrays and I want to merge them into one while extracting only certain elements...

I am using axios with vueJS.

(9) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
0:
Nombredejours: 1.5
Task: {id: "52edcb0e-450f-4de7-b70d-b63e047d243d", name: "ABSENCE", description: "", start: "2019-10-03T00:00:00.000Z", end: "2099-10-02T00:00:00.000Z", …}
TaskId: "52edcb0e-450f-4de7-b70d-b63e047d243d"
User: {id: "93d04717-1e1e-41f7-8777-b89ac373a900", lastname: "Le Luron", firstname: "David", email: "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b7d3d6c1ded399dbd29adbc2c5d8d9f7c7d8dbcedad8d9c399d1c5">[email protected]</a>", password: "$2a$10$FEZbZz.Ik83iMRGuOd7Lse.udgVZH1daLE/wdSR4Q3csWNY.KOLc6", …}
UserId: "93d04717-1e1e-41f7-8777-b89ac373a900"
UserNumber: 1
createdAt: "2019-10-03T15:18:03.000Z"
end: "2019-10-12T00:00:00.000Z"
heuredebut: "13:00:00"
heurefin: "18:00:00"
id: "03d71d77-3627-4830-9c1e-811a2a58b505"
start: "2019-10-10T00:00:00.000Z"
updatedAt: "2019-10-03T15:18:03.000Z"
__proto__: Object
1:
Nombredejours: 2

What I want:

start: "2019-10-10T00:00:00.000Z"

and

timeStart: "13:00:00"

To achieve this,

start: '2018-11-19 10:35',

Answer №1

Here's a solution for your problem:

let start = "2019-10-10T00:00:00.000Z"
let timeStart = "13:00:00"

let date = new Date(start);
let new_date = date.getFullYear()+'-' + (date.getMonth()+1) + '-'+date.getDate()+' '+ timeStart.slice(0,5);//this will give you the desired format.

console.log(new_date)

Answer №2

Here is a possible solution:

let start = new Date("2021-05-20T00:00:00.000Z").toLocaleString('fr-FR');
console.log(start);

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

Click to slide the div down and up when needed

Currently, I am utilizing the code below to implement a slide up/down effect on a div using JavaScript. The slide down action is triggered by a button, while the slide up action is associated with a close text. My goal is to have the button toggle betwee ...

Guide on transferring Json Data from Aspx page

Recently, I made an attempt to utilize TokenInput Jquery for a multiple value autocomplete feature that requires the JSON response as input data. If you're interested in exploring more about Token Input Jquery, you can check out this link: In my cas ...

Utilizing a Python/Cython Numpy array by Sending Numpy Array to C Pointer

I have been facing an issue where I am attempting to pass a Cython-numpy array to a C struct. It works fine for arrays of 'small' size but crashes when the array size exceeds a certain limit. The strange thing is that the array size I am using is ...

Ways to incorporate conditional logic with URL query parameters in Next.JS

I'm trying to implement conditional logic based on a URL query. In this scenario, I want to greet Kátia Fantes dynamically when she visits localhost:3000/katia-fantes. Any suggestions on how to achieve this? import { useRouter } from 'next/rou ...

Adding default Google fonts to text elements in a D3.js SVG

Can anyone guide me on how to integrate Google fonts into a d3 text element? For example: g.append('text') .attr('x', width / 2) .attr('y', height / 3) .text('roboto') .style("font-family" ...

The proper method for clearing out all items from the environment

Although there are numerous questions on SO that address the topic of removing everything from a scene, none of the methods I've tried seem to work as expected. There isn't a definitive solution provided in the documentation either, so I'm h ...

jQuery function used to create an HTML menu

My goal is to dynamically update the HTML file generated by a PHP script when I modify an item in a drop-down menu using jQuery. Here is the code: JQUERY <script type="text/javascript"> $(document).ready(function() { $('#regioni&ap ...

Slick carousel not functioning properly with Angular slickGoTo

I am currently working with the angular-slick-carousel library. Unfortunately, I am encountering an issue where the Slick methods, such as slickGoTo(), are not functioning as expected. Below is my Controller setup following the provided documentation: $s ...

How can we assign priority to the child element for detection by the "mouseover" event in jQuery?

Can you help me figure out how to make the "mouseover" event prioritize detecting the child element over its parent? This is the jQuery code I've been using: <script> $(function() { $("li").mouseover(function(event){ $('#log&a ...

What sets apart using import './style.scss'; in main.ts from the css.preprocessorOptions configuration?

Check out the demo here: https://stackblitz.com/edit/vitejs-vite-qzqife?file=src/style.scss This is the content of style.scss: $color: red; Within main.ts file: import './style.scss'; Encountering an error when using $color in <style lang=& ...

Issues with Firebase-admin preventing writing to the database are occurring without any error messages being displayed

Issues with Firebase admin writing to the database. The database is instantiated as follows: var db = admin.database(); A reference to the desired table is then set up: var systemsRef = db.ref("systems/"); A function is created to check if a 'sys ...

Returning a JSON representation of a JavaScript object

In the process of working on a script, I encountered a situation where an $.ajax call had to invoke a function upon success, returning a JavaScript object in JSON format [object object]. However, despite being able to return a well-formatted string, access ...

Implementing the expand and collapse functionality to the Discovery sidebar on the DSpace 4.2 xmlui platform

I recently began using DSpace and I am attempting to implement an expand/collapse feature in the Discovery sidebar of DSpace 4.2 xmlui using the Mirage theme. After finding some helpful jquery code, I attempted to add this functionality by placing the js f ...

The TextInput field is not displaying my placeholder text - what could be causing this issue?

I am facing an issue where the placeholder is not appearing on both <TextInput> elements, and when the user inputs something, it does not show up in those <TextInput> boxes. I need to understand why this behavior is occurring. Below is the con ...

Fetching only JSON object values from a JSON array in Laravel 5.2: Best practices

Here is the database query I am working with: $beneficiary_id = DB::select('select Telephone from item '); After executing this query, I receive a JSON array that looks like this: [{"Telephone":"0111222333"},{"Telephone":"0112211223"},{"Teleph ...

What is the best way to retrieve the most recent value in a MongoDB aggregation?

In my collection, some documents have a status field while others do not. However, all documents contain a data field. I am trying to construct a query that retrieves the most recent values for both fields. The issue arises when using the $last operator, a ...

Unable to detect errors using React/Redux

I encountered a login error handling issue with redux that is structured like this: export const login = (params: any) => async (dispatch: Dispatch) => { try { const authData = await API.post("login", params); sessionStorage.setIt ...

Leveraging an Array of Objects in JavaScript

Need help with my JavaScript code! I want to adjust the date in a Date object by adding specific days and then save it. Here is what I have so far: let orderIdDateCorrectionDict = [ { "orderId": "2020053100", "dayCorrection": -146 }, { "orderId" ...

Tips for effectively managing the timeout of server-side AJAX calls1. Maxim

I'm currently developing server code in ASP.NET with the MVC framework. The client-side code is written in javascript. When sending an AJAX request from the browser to the server, whether using JQuery or not, timeouts can be set. Additionally, the br ...

What is the best way to utilize useEffect solely when the length of an array has

Is there a way to trigger a state update only when the length of the prop "columns" changes? useEffect(() => { if (columns.length !== prevColumns.length) { // update state } }, [columns]); Any suggestions on how to achieve this? ...