Skip to content

Commit 74e5344

Browse files
committed
MaterialDatePicker - Added Formating Rules table for DateFormat construction
1 parent a9f00d9 commit 74e5344

File tree

2 files changed

+78
-4
lines changed

2 files changed

+78
-4
lines changed

src/main/java/gwt/material/design/demo/client/application/components/forms/listbox/ListBoxView.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,12 @@ interface Binder extends UiBinder<Widget, ListBoxView> {
4444
MaterialListBox lstOptions, lstSetValue, lstAddOptions, lstRemoveOptions, lstLazy;
4545

4646
@UiField
47-
MaterialListValueBox<Hero> lstValueBox, lstValueBoxMultiple, lstEmptyPlacehoder, lstFocusAndBlur;
47+
MaterialListValueBox<Hero> lstValueBox, lstEmptyPlacehoder, lstFocusAndBlur;
4848

4949
@Inject
5050
ListBoxView(Binder uiBinder) {
5151
initWidget(uiBinder.createAndBindUi(this));
5252

53-
buildListHeroes(lstValueBoxMultiple);
5453
buildListHeroes(lstValueBox);
5554
buildListHeroes(lstEmptyPlacehoder);
5655

src/main/java/gwt/material/design/demo/client/application/components/pickers/PickersView.ui.xml

Lines changed: 77 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@
2222
xmlns:g="urn:import:com.google.gwt.user.client.ui"
2323
xmlns:m="urn:import:gwt.material.design.client.ui"
2424
xmlns:demo="urn:import:gwt.material.design.demo.client.ui">
25+
<ui:style gss="true">
26+
@external format-table;
27+
28+
table.format-table tr td {
29+
padding: 20px;
30+
}
31+
</ui:style>
2532
<g:HTMLPanel>
2633
<m:MaterialRow addStyleNames="code">
2734
<m:MaterialTitle title="Basic" description="You can easily add placeholder to indicate a label into your datepicker."/>
@@ -118,14 +125,82 @@
118125

119126
<m:MaterialRow addStyleNames="code">
120127
<m:MaterialTitle title="Formats" description="You can set the format of the date picker by adding format='FORMAT'"/>
121-
<m:MaterialDatePicker ui:field="dpFormat" grid="s12" placeholder="Custom Format" format="Yehey yyyy mm dd"/>
128+
<m:MaterialDatePicker ui:field="dpFormat" grid="s12" placeholder="Custom Format" format="YYYY/MM/DD"/>
122129
<m:MaterialButton ui:field="btnSetFormat" text="Set Date with custom format"/>
123130

124131
<demo:PrettyPre addStyleNames="lang-xml">
125132
&emsp;&lt;m:MaterialDatePicker ui:field="dpFormat" placeholder="Custom Format" format="yyyy mm dd"/>
126133
</demo:PrettyPre>
127134
</m:MaterialRow>
128-
135+
136+
<m:MaterialRow addStyleNames="code">
137+
<m:MaterialTitle title="Formatting Rules" description="The following rules can be used to format any date supported by Pickadate JS (Our core datepicker API)" />
138+
<g:HTMLPanel>
139+
<table class="format-table striped">
140+
<thead>
141+
<tr>
142+
<th>Rule</th>
143+
<th>Description</th>
144+
<th>Result</th>
145+
</tr>
146+
</thead>
147+
148+
<tbody>
149+
<tr>
150+
<td>d</td>
151+
<td>Date of the month</td>
152+
<td>1 – 31</td>
153+
</tr>
154+
<tr>
155+
<td>dd</td>
156+
<td>Date of the month with a leading zero</td>
157+
<td>01 – 31</td>
158+
</tr>
159+
<tr>
160+
<td>ddd</td>
161+
<td>Day of the week in short form</td>
162+
<td>Sun – Sat</td>
163+
</tr>
164+
<tr>
165+
<td>dddd</td>
166+
<td>Day of the week in full form</td>
167+
<td>Sunday – Saturday</td>
168+
</tr>
169+
<tr>
170+
<td>m</td>
171+
<td>Month of the year</td>
172+
<td>1 – 12</td>
173+
</tr>
174+
<tr>
175+
<td>mm</td>
176+
<td>Month of the year with a leading zero</td>
177+
<td>01 – 12</td>
178+
</tr>
179+
<tr>
180+
<td>mmm</td>
181+
<td>Month name in short form</td>
182+
<td>Jan – Dec</td>
183+
</tr>
184+
<tr>
185+
<td>mmmm</td>
186+
<td>Month name in full form</td>
187+
<td>January – December</td>
188+
</tr>
189+
<tr>
190+
<td>yy</td>
191+
<td>Year in short form *</td>
192+
<td>00 – 99</td>
193+
</tr>
194+
<tr>
195+
<td>yyyy</td>
196+
<td>Year in full form</td>
197+
<td>2000 – 2999</td>
198+
</tr>
199+
</tbody>
200+
</table>
201+
</g:HTMLPanel>
202+
</m:MaterialRow>
203+
129204
<m:MaterialRow addStyleNames="code">
130205
<m:MaterialTitle title="Date Limit" description="You can limit the date by calling setDateLimit(Date min, Date max) method."/>
131206
<m:MaterialDatePicker ui:field="dpLimit" placeholder="With Limit"/>

0 commit comments

Comments
 (0)