After a short period of time, the format reveals a completely new value

Can you explain the reason for this unusual behavior? Could it be related to the incoming date format or something else?

.html

 <ion-datetime displayFormat="D MMM, YYYY" [min]="minDate" [max]="maxDate" 
[ngModel]="data?.dueOn" (ngModelChange)="data.dueOn=$event;"
name="dueOn" class="date-picker-right-align"></ion-datetime>

.ts

auditLogDueOnDays = `Payment due date changed from 
${moment(this.oldTransactionValue.dueOn).format("d MMM YY")} to 
${moment(data.dueOn).format("d MMM YY")} `;

https://i.sstatic.net/qtHmT.gif

Answer №1

Oops, I made a mistake :(

Weekday W 0 1 ... 5 6

Correct way to reference:

Month Day M 1 2 ... 30 31

updatedDueDate = `Changed payment deadline from 
${moment(this.oldTransactionValue.dueOn).format("D MMM YY")} to 
${moment(data.dueOn).format("D MMM YY")} `;

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

Mongoose's hook function is effective in the pre-stage but ineffective in the post-stage

When using Mongoose hooks, I aim to automatically change the status property to false if the outstandingBalance property has a value of zero. Although attempting to achieve this with Mongoose's PRE hook works, it requires re-invoking the request afte ...

The issue at hand involves Javascript, Ajax, latte, and Presenter where there seems to be a restriction on using GET requests for a file located

I have a query. I’ve been given the task of adding a new function to our web application. It was built on PHP by someone else, so it's proving quite challenging for me to debug as I am not familiar with this technology. I’m attempting to incorpor ...

Why does appending to a TextArea field fail in one scenario but succeed in another when using Javascript?

There is a JavaScript function that captures the value from a select dropdown and appends it to the end of a textarea field (mask) whenever a new selection is made. function addToEditMask(select, mask) { var selectedValue = document.getElementById(sel ...

Capitalizing a specific letter in a string at a designated index

Looking for an efficient way to convert a specific letter in a string to uppercase? Let's explore different methods: Suppose we have the string: let str = "Dwightschrute"; One way to achieve this is by slicing the string and then updating the desir ...

Using AngularJS to dynamically bind HTML content based on a variable’s value

I am trying to dynamically display an image of a man or a woman on a scene, depending on the gender of the person logged into my website. The ng-bind-html directive is working fine when I define "imageToLoad" statically. However, it fails when I try to gen ...

The ngAfterViewChecked function seems to be caught in an endless loop

I am facing an issue where the <cdk-virtual-scroll-viewport> starts from the bottom, but I am unable to scroll up. I suspect that this problem is related to the use of AfterViewChecked. Even after trying AfterViewInit, the issue persists. @ViewChil ...

Using Heroku to deploy NodeJS applications

I am facing an issue while trying to deploy my NodeJS project on Heroku. The project is a multiplayer game where, locally, both players enter the same map successfully. However, on Heroku, I am unable to get both players on the same map. Below is a snippe ...

How come my directive is being updated when there are changes in a different instance of the same directive?

For the purpose of enabling Angular binding to work, I developed a straightforward directive wrapper around the HTML file input. Below is the code for my directive: angular.module('myApp').directive('inputFile', InputFileDirective); f ...

"My discord.js bot seems to be sending multiple GIFs in one go instead of just one. Any ideas on how to

Can anyone assist me with a Discord bot command issue? I'm trying to make a command that sends a random Kirby gif using the Giphy API, but it keeps sending multiple gifs instead of just one. Here is the code snippet: client.on('message', mes ...

Angular input material with a stylish twist

How can I style all inputs on the Angular Material input component (matInput) using Typescript? I attempted to implement this solution, but it only affects the first element. ngAfterViewInit () { const matlabel = this.elRef.nativeElement.querySelecto ...

Discovering old (potentially neglected) npm dependencies: strategies for locating outdated packages

I am aware of the npm outdated command, which shows out-of-date dependencies only if a new version has been published. However, in certain cases (such as abandoned projects), there may not be a new version released and the package could still be considere ...

Guide on utilizing the chosen dropdown field across multiple components

I am looking for a solution to share the chosen value with all components, allowing it to be accessed whenever needed. ...

Do you find encodeURIComponent to be extremely helpful?

I'm still puzzled about the benefit of using the JS function encodeURIComponent to encode each component of an http-get request when communicating with the server. After conducting some experiments, I found that the server (using PHP) is able to rece ...

Determining the offsetWidth and scrollWidth for option elements within a select field containing the multiple attribute on Internet Explorer 11

My select input element has multiple attributes and a fixed width set. Unfortunately, due to the fixed width, the overflowing content in the x-direction is not visible. To address this issue, I have created a JavaScript function that uses the title attribu ...

Angular Elements - Additional Attribute Bindings

My goal is to create a series of versatile components (angular 1.5) with various optional bindings that can be utilized in multiple applications. I am concerned about the potential creation of unnecessary watchers for an application that does not utilize ...

How much time can the browser dedicate to running JavaScript before moving on to loading a new page?

The webpage contains multiple hyperlinks. I want to monitor user clicks on these links. Whenever a user clicks on a link, an Ajax request is sent to my server for processing. The server then returns relevant data, which is further processed on the client ...

Is there a way to convert various elements sharing the same class into a list of array items?

Essentially, I am dealing with multiple elements sharing the same class name. My goal is to retrieve an array of integers from an API and then iterate through each element with this class name, replacing them with elements from the array sequentially. For ...

Steps for creating an observable array using a Firestore DocumentReference array field

I am in the process of organizing a firestore database specifically for e-commerce functions. At the moment, I have a main collection for products and another for users. The users collection includes an array field named cart where I store DocumentReferenc ...

The for loop is not pausing to wait for the callback to complete within the loop

My objective is to display multiple .stl files in various divs on a webpage and retrieve model information for each model (such as volume, area, xyz coordinates, etc.). To accomplish this, I am utilizing , which is built on three.js The HTML code snippet: ...

How to retrieve the ID of a parent sibling using jQuery DataTables

I have encountered a peculiar issue while trying to retrieve the ID of a table's parent sibling. Prior to initializing jQuery DataTables, obtaining the table's ID poses no problem. However, once it is initialized and the table is built, retrievin ...