Commit eb46d8b72ed8bf65b93078dcf0ebaeed4b43d2f6
1 parent
92cac350
Exists in
master
and in
33 other branches
Properly handle noosfero dates to avoid the momentjs warning
Showing
8 changed files
with
36 additions
and
6 deletions
Show diff stats
src/app/components/noosfero-activities/activity/add_member_in_community.html
... | ... | @@ -7,7 +7,7 @@ |
7 | 7 | <a ui-sref="main.profile.info({profile: ctrl.activity.user.identifier})"><strong ng-bind="ctrl.activity.user.name"></strong></a> |
8 | 8 | <span> has joined the community</span> |
9 | 9 | </h4> |
10 | - <p><small class="text-muted"><i class="fa fa-clock-o"></i> <span am-time-ago="ctrl.activity.created_at"></span></small></p> | |
10 | + <p><small class="text-muted"><i class="fa fa-clock-o"></i> <span am-time-ago="ctrl.activity.created_at | dateFormat"></span></small></p> | |
11 | 11 | </timeline-heading> |
12 | 12 | <div class="timeline-body"></div> |
13 | 13 | </timeline-panel> | ... | ... |
src/app/components/noosfero-activities/activity/create_article.html
... | ... | @@ -10,7 +10,7 @@ |
10 | 10 | <strong ng-bind="ctrl.activity.target.article.profile.name"></strong></span> |
11 | 11 | </a> |
12 | 12 | </h4> |
13 | - <p><small class="text-muted"><i class="fa fa-clock-o"></i> <span am-time-ago="ctrl.activity.created_at"></span></small></p> | |
13 | + <p><small class="text-muted"><i class="fa fa-clock-o"></i> <span am-time-ago="ctrl.activity.created_at | dateFormat"></span></small></p> | |
14 | 14 | </timeline-heading> |
15 | 15 | <div class="timeline-body"> |
16 | 16 | <div class="article"> | ... | ... |
src/app/components/noosfero-activities/activity/new_friendship.html
... | ... | @@ -12,7 +12,7 @@ |
12 | 12 | </a> |
13 | 13 | </span> |
14 | 14 | </h4> |
15 | - <p><small class="text-muted"><i class="fa fa-clock-o"></i> <span am-time-ago="ctrl.activity.created_at"></span></small></p> | |
15 | + <p><small class="text-muted"><i class="fa fa-clock-o"></i> <span am-time-ago="ctrl.activity.created_at | dateFormat"></span></small></p> | |
16 | 16 | </timeline-heading> |
17 | 17 | <div class="timeline-body"></div> |
18 | 18 | </timeline-panel> | ... | ... |
src/app/components/noosfero-articles/article/article.html
... | ... | @@ -6,7 +6,7 @@ |
6 | 6 | <div class="sub-header clearfix"> |
7 | 7 | <div class="page-info pull-right small text-muted"> |
8 | 8 | <span class="time"> |
9 | - <i class="fa fa-clock-o"></i> <span am-time-ago="ctrl.article.created_at"></span> | |
9 | + <i class="fa fa-clock-o"></i> <span am-time-ago="ctrl.article.created_at | dateFormat"></span> | |
10 | 10 | </span> |
11 | 11 | <span class="author" ng-if="ctrl.article.author"> |
12 | 12 | <i class="fa fa-user"></i> | ... | ... |
src/app/components/noosfero-blocks/recent-documents/recent-documents.html
... | ... | @@ -8,7 +8,7 @@ |
8 | 8 | |
9 | 9 | <div class="subheader"> |
10 | 10 | <span class="time"> |
11 | - <i class="fa fa-clock-o"></i> <span am-time-ago="card.created_at"></span> | |
11 | + <i class="fa fa-clock-o"></i> <span am-time-ago="card.created_at | dateFormat"></span> | |
12 | 12 | </span> |
13 | 13 | </div> |
14 | 14 | </div> | ... | ... |
src/app/components/noosfero/date-format/date-format.filter.spec.ts
0 → 100644
... | ... | @@ -0,0 +1,19 @@ |
1 | +import {quickCreateComponent} from "../../../../spec/helpers"; | |
2 | +import {DateFormat} from './date-format.filter'; | |
3 | + | |
4 | +describe("Filters", () => { | |
5 | + describe("Date Format Filter", () => { | |
6 | + | |
7 | + beforeEach(angular.mock.module("templates")); | |
8 | + | |
9 | + it("convert date from the format returned by noosfero api to an ISO format", done => { | |
10 | + let date = "2016/03/10 10:46:47"; | |
11 | + let htmlTemplate = `{{ '${date}' | dateFormat }}`; | |
12 | + quickCreateComponent({ providers: [DateFormat], template: htmlTemplate }).then(fixture => { | |
13 | + expect(fixture.debugElement.text()).toEqual('"2016-03-10T13:46:47.000Z"'); | |
14 | + done(); | |
15 | + }); | |
16 | + }); | |
17 | + | |
18 | + }); | |
19 | +}); | ... | ... |
src/app/components/noosfero/date-format/date-format.filter.ts
0 → 100644
src/app/main/main.component.ts
... | ... | @@ -12,6 +12,7 @@ import {ProfileImageBlock} from "../components/noosfero-blocks/profile-image-blo |
12 | 12 | |
13 | 13 | import {MembersBlock} from "../components/noosfero-blocks/members-block/members-block.component"; |
14 | 14 | import {NoosferoTemplate} from "../components/noosfero/noosfero-template.filter"; |
15 | +import {DateFormat} from "../components/noosfero/date-format/date-format.filter"; | |
15 | 16 | |
16 | 17 | import {AuthService} from "./../components/auth/auth_service"; |
17 | 18 | import {Session} from "./../components/auth/session"; |
... | ... | @@ -37,7 +38,7 @@ export class MainContent { |
37 | 38 | directives: [ |
38 | 39 | ArticleBlog, ArticleView, Boxes, Block, LinkListBlock, |
39 | 40 | MainBlock, RecentDocumentsBlock, Navbar, ProfileImageBlock, |
40 | - MembersBlock, NoosferoTemplate | |
41 | + MembersBlock, NoosferoTemplate, DateFormat | |
41 | 42 | ], |
42 | 43 | providers: [AuthService, Session] |
43 | 44 | }) | ... | ... |