Skip to content

Commit

Permalink
Added everything for Step 16: Adding the Date Formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
wridgeu committed Jun 11, 2020
1 parent 5cccb62 commit c41978e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 5 additions & 1 deletion webapp/model/formatter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sap.ui.define([], function () {
sap.ui.define(["com/mrb/UI5-Testing/model/DateFormatter"], function (DateFormatter) {
"use strict";
return {
/**
Expand Down Expand Up @@ -32,5 +32,9 @@ sap.ui.define([], function () {
return "Error";
}
},

date: function(date) {
return new DateFormatter({now: Date.now}).format(date);
}
};
});
7 changes: 4 additions & 3 deletions webapp/view/Post.view.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<mvc:View controllerName="com.mrb.UI5-Testing.controller.Post"
xmlns="sap.m"
xmlns:mvc="sap.ui.core.mvc"
xmlns:form="sap.ui.layout.form"
xmlns:mvc="sap.ui.core.mvc"
xmlns:form="sap.ui.layout.form"
xmlns:semantic="sap.m.semantic">
<semantic:FullscreenPage id="page" busy="{postView>/busy}" busyIndicatorDelay="0" navButtonPress=".onNavBack" showNavButton="true" title="{i18n>objectTitle}">
<semantic:content>
Expand All @@ -16,7 +16,8 @@
<form:SimpleForm>
<form:content>
<Label text="{i18n>postDateLabel}"/>
<Text text="{Timestamp}"/>
<Text text="{path: 'Timestamp',
formatter: '.formatter.date'}"/>
<Label text="{i18n>postDescriptionLabel}"/>
<Text text="{Description}"/>
</form:content>
Expand Down

0 comments on commit c41978e

Please sign in to comment.