Avatar of Bruce Gust
Bruce Gust
Flag for United States of America

asked on 

I need to format this date! How?

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) {
                              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 {
                                    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?

Avatar of undefined
Last Comment
Chris Stanyon

8/22/2022 - Mon