Change display of WP REST API Date - angularjs

I'm doing a Angular Wordpress theme and displaying the date on posts using {{post.date}} . This displays the date as it is in the WP REST API as 2017-07-17T12:48:51 . I am wanting to display the date as July 7, 2017 .I've tried changing the date in the general settings date format but that did not affect the display of the date.

use filter like following:
{{post.date | date}}

Related

Display Timestamp using AngularJS

I am trying to display timestamp using angular. At the backend on console log I am getting date like this 2020-09-03 00:00:00.0 but when I trying to get date at frontend it is displaying like this 1600021800000. How can I display date in regular format?
This how I get date on console using spring boot -
And when get it at frontend it display like this -
How can I display date like this 2020-09-03 00:00:00.0?
Suppose your date is in $scope.dateTime
<p>{{dateTime | date:'yyyy-MM-dd HH:mm:ss.sss'}}</p>
Just put this wherever you want to show your formatted date in your HTML. Look up angularjs date api for more information regarding formatting

mattlewis92/angular-bootstrap-calendar calculating Wrong Dates on different Timezone

I am using this calendar https://github.com/mattlewis92/angular-bootstrap-calendar for showing events and time slots for people all over the world. During sign up, every user has to set his timezone and then my application uses this timezone for further date computation rather than client machine timezone.
The problem is that when I make user timezone default using moment.tz.setDefault(timezone) and change the machine's timezone, the calendar calculates dates wrongly.
Here is my excerpt of my code:
moment.tz.setDefault($rootScope.timezone)
vm.calendarView = 'month';
vm.viewDate = moment().startOf('month').toDate();
vm.cellIsOpen = true;
Attached is the screenshot:
[Screenshot]
You can see that user's timezone is currently Asia/Karachi +5 and my machine's timezone is Beijing +8. Today's date is 8 September and the day is Friday, but on the calendar 8 September is showing as a Saturday instead of Friday.
mwl-calander did not provide support for timezone, you can use full calander
https://fullcalendar.io/
Demo https://fullcalendar.io/js/fullcalendar-2.9.1/demos/timezones.html
Its angular directive can be found at
https://github.com/angular-ui/ui-calendar
It would appear that this particular UI control does not support selecting a time zone. Simply using moment.tz.setDefault is not good enough, because everything the control is doing both internally and in its external API is using Date objects, which cannot represent arbitrary time zones. In other words, the author of that control would have to remove all .toDate() calls and use Moment objects as the primitive in the control instead of Date objects. That would be a breaking change for them.
I suggest filing an issue in that project's GitHub repository, and reference this page.

How can I remove days from another month using UI-Calendar from UI-AngularJS?

I'm using ui-calendar to build a dynamic calendar for my app. How can I remove days from another months?
For example:
The calendar shows April. But I don't want to show days from March and May.
Obs:
I can put a visibility class to the elements like that
$(".fc-other-month").css({ "visibility" : "hidden" });
But I don't know if it's the correct for to do that.
You can use:
fixedWeekCount: false
You can see in the documentation (http://fullcalendar.io/docs/display/fixedWeekCount/)

AngularJS: displaying wrong date

I have the following datetime:
2015-03-04T00:00:39+00:00
I am trying to display the date as follows using AngularJS
{{entry.entryDate | date:'MM/dd'}}
However, when I do this, it displays 03/03 instead of 03/04.
The date displays correctly for any time before 1900. But when a datetime is 1900 or later, it always displays 03/03 instead of 03/04.
Any idea how I can fix this?
According to AngularJS documentation you can find here , you can set timezone as shown below.
{{ date_expression | date : format : timezone}}
I ended up creating a custom filter to format in utcTime. This SO question helped point me in the right direction.
Why is Angular date filter displaying wrong date?

How to render Drupal 7 Date Field

How can I properly render exclusively end date from the Drupal 7 Date field in template file?
$node->field_start_date[LANGUAGE_NONE][0]` (is it correct?)
I can get to raw values but I want it to get formatted etc.
You can use the code below:
drupal_render(field_view_field('node', $node, 'field_end_datetime'));
field_view_field: https://api.drupal.org/api/drupal/modules!field!field.module/function/field_view_field/7

Resources