Skip to content

Commit c41978e

Browse files
committed
Added everything for Step 16: Adding the Date Formatter
1 parent 5cccb62 commit c41978e

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

webapp/model/formatter.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
sap.ui.define([], function () {
1+
sap.ui.define(["com/mrb/UI5-Testing/model/DateFormatter"], function (DateFormatter) {
22
"use strict";
33
return {
44
/**
@@ -32,5 +32,9 @@ sap.ui.define([], function () {
3232
return "Error";
3333
}
3434
},
35+
36+
date: function(date) {
37+
return new DateFormatter({now: Date.now}).format(date);
38+
}
3539
};
3640
});

webapp/view/Post.view.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<mvc:View controllerName="com.mrb.UI5-Testing.controller.Post"
22
xmlns="sap.m"
3-
xmlns:mvc="sap.ui.core.mvc"
4-
xmlns:form="sap.ui.layout.form"
3+
xmlns:mvc="sap.ui.core.mvc"
4+
xmlns:form="sap.ui.layout.form"
55
xmlns:semantic="sap.m.semantic">
66
<semantic:FullscreenPage id="page" busy="{postView>/busy}" busyIndicatorDelay="0" navButtonPress=".onNavBack" showNavButton="true" title="{i18n>objectTitle}">
77
<semantic:content>
@@ -16,7 +16,8 @@
1616
<form:SimpleForm>
1717
<form:content>
1818
<Label text="{i18n>postDateLabel}"/>
19-
<Text text="{Timestamp}"/>
19+
<Text text="{path: 'Timestamp',
20+
formatter: '.formatter.date'}"/>
2021
<Label text="{i18n>postDescriptionLabel}"/>
2122
<Text text="{Description}"/>
2223
</form:content>

0 commit comments

Comments
 (0)