How to eliminate curly braces in Vue.js programming

Here is the data I'm working with:

{
    success: true,
    message: "success",
    data: {
        schedule_id: 2,
        estimated_practice_time: "20",
        day: "{0,1}",
        from_time: "{08:00:00,09:00:00}",
        until_time: "{18:00:00,19:00:00}"
    }
}

This is what I currently have:

https://i.sstatic.net/h2yl2.png

I am trying to only display the value under "day", removing the curly braces:

0,1

Answer №1

Implement a computed property that removes the curly brackets by replacing them with an empty string:

computed:{
     formattedDay(){
         return this.dataObject.day.replace(/[{}]/g,'');
   }
}

Answer №2

To accomplish this, you can utilize regular expressions

let b = '{3,4}'
b = b.replace(/[{}]/g, '');
console.log(b)

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

When should we opt for constructor injection versus using spyOn() injection in different scenarios, and which approach is more effective?

When constructing my MaintainCOCComponent, I include a parameter for the MaintainCOCService which contains the API call method service. export class MaintainCOCComponent { constructor(private maintaincocservice: MaintainCOCService) { } } Using Constr ...

Passing generated JavaScript parameters from a form to a Rails controller

I'm using a form_for that includes 2 date fields and 1 integer. :start, id: "start" :end, id: "end" :number_of_days, id: "number_of_days" This is the JavaScript I'm using: $(document).ready(function(){ $("#start, #end").on('change&apo ...

Obtaining UTC dates with JavaScript: A guide

Can someone help me figure out how to retrieve the current UTC date using Javascript? I see there are methods available for getting the time in UTC, such as: date.getUTCHours(); But how can I specifically obtain the date? ...

retrieving information from server via ajax to display on chart

I am currently utilizing the jqPlot JavaScript library for generating graphs and charts in one of my applications, which can be found at . Within my application, there are approximately 5-6 pages where I have integrated this library. However, I would like ...

What could be causing the React state not to update properly?

Having an issue with my Alice-Carousel in react. I'm fetching items from an API and updating the array for the carousel, but the value of items keeps coming back as undefined. Using CryptoState context to avoid prop drilling. import React from 'r ...

Guide to playing a downloaded video file in Ionic Capacitor by accessing the file's URI path

I recently created a repository on GitHub based on a blog post by Josh Morony that explores obtaining camera or gallery images and displaying them on a webpage. While the functionality works seamlessly on iOS, I have encountered issues with it not function ...

Adding and adjusting the size of different DIV elements within a shared area

Looking to create a dynamic bar with the ability to add multiple child DIVs (similar to this: https://i.stack.imgur.com/tdWsq.jpg). Utilizing jQuery, jQuery UI, Bootstrap, and various plugins. The structure for the div (or span) system could be structured ...

Issues with Angular Component not detecting changes in @Input array

I'm dealing with a challenging setup where: The Parent Service (A) is imported in the Parent Component (B). Then, the Parent Component passes an array of Objects to a Child Component (C), which are referenced from the Parent Service (e.g. <child-c ...

Executing TypeScript code with Mocha in a web browser

I have successfully managed to execute Mocha tests in the browser using ES6 / Typescript with the following code: // test.ts import 'mocha/mocha.css'; import * as M from 'mocha/mocha-es2018'; import { expect } from 'chai'; M ...

Is there a way to delete values from a JavaScript object and include an index column?

I currently have this incoming dataset: [] 0:{"time": 1525355921817, "sym": "AAPL", "price": 169.16, "size": 98, "stop": false, …} 1:{"time": 1525355923216, "sym": "AAPL", "price": 170.15, "size": 6, "stop": false, …} 2:{"time": 1525355923216, "sym": " ...

Jquery animate - callback is triggered before animation finishes running

Is there a way for the element to first expand in height and then apply a background image once the height change is complete? Currently, I am experiencing laggy performance as the background image is applied before the height animation finishes. Can som ...

Differences between HTML server control and ASP.NET web controlsHTML server

When attempting to trigger a javascript function upon clicking a server control button, I encountered an issue. Using an html button control with the runat="server" attribute allowed me to successfully call the function. However, when employing an ASP.net ...

Unable to get i18next functioning in my Node.js Express backend

I'm currently facing difficulties in implementing localization for my nodeJS backend. Within my Angular frontend, I have a language-setting interceptor that successfully sets the language in the request header. You can refer to the image below which ...

Guide to positioning a button on top of another button using Vuetify

I'm facing an issue where I want to add a button on a clickable card, but clicking the button also triggers the card click event. Here's my current code snippet: <v-card @click="show = !show"> <v-img src="https://cdn.vuetifyjs.com/im ...

Transform a Mongoose object into a specific JSON schema

When retrieving data from MongoDB using mongoose as an ORM, I have a specific requirement. Instead of sending all the fetched information back to the client in the response, I need to convert the mongoose object into a JSON object that adheres to my cust ...

Adding a service into a different service within AngularJS

I'm trying to add a login module to my AngularJS app. When I try to call UserService from the authenticationService, it's showing as undefined. What am I missing here, why is UserService coming up as undefined? var authenticationService = angula ...

Combining arrays in a nested array with the help of Javascript/Vue.Js

I am faced with a JSON array containing 3 arrays that I need to merge into one array after fetching the JSON data. Although I attempted to do so using Vue.JS, the resulting array appears to be empty. MY FIRST ATTEMPT this.items = items; MY LATEST ATTEMP ...

Waveform rendering in HTML5 using wavesurfer.js struggles to handle large mp3 files

Recently, I was considering incorporating wavesurfer.js into one of my projects so I decided to explore the demo on To test it out, I uploaded a large mp3 file (approximately 2 hours long) onto the designated area in the middle of the page. It appeared to ...

The characteristics of a const anonymous function in JavaScript

I keep encountering an issue when attempting to determine the length of an anonymous array. I am uncertain if this operation is permitted or not. const gamearena = function () { var matrix = []; var height = 20; var width = 10; while(heig ...

Using Parseint in a Vue.js method

For instance, let's say this.last is 5 and this.current is 60. I want the sum of this.last + this.current to be 65, not 605. I attempted using parseInt(this.last + this.current) but it did not work as expected. <button class="plus" @click="plus"&g ...