troubleshooting Question

I need to format this date! How?

Avatar of Bruce Gust
Bruce GustFlag for United States of America asked on
JavaScriptNode.js
2 Comments1 Solution27 ViewsLast Modified:
Here's the way I'm inserting the date coming from an "update" function:

ajax: {
                        path: '/companies/update-activity',
                        params: {
                              company: companyId,
                              activityId: activityId
                        },
                        onComplete: function (resp, self) {
                        if (resp.error) {
                              self.addMsg(resp.msg);
                              return false;
                        }
                              if(dashboard=="yes") { //slightly different "success" message for the dashboard
                                    CAMS.alert('You have successfully updated your activity! Please refresh your page to see the changes.');
                                    return false;
                              }
                              else {
                                    $('#notes-'+activityId).text(resp.notes);
                                    $('#date-'+activityId).text(resp.date);
                                    $('#type-'+activityId).text(resp.type);
                                    CAMS.alert('You have successfully updated your activity!');
                                    return false
                              }
                        }
                  }

You see what's happening? I run my AJAX call and the data coming back from the update method gets inserted into the form giving the user the ability to feel like the pop up window reflects the changes they just made.

My challenge is that the format of the date needs to match what's going on in the app.

So, instead of the 4/18/2020 4:02 PM that you see in the date field...

date screenshot
...it needs to read Apr 18th, 2020 4:02 PM

I tried this: b]$('#date-'+activityId).text(resp.date("M jS, Y \\a\\t g:i a"));[/b]

...but that didn't work.

What am I missing?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros