Skip to content

Commit

Permalink
Cleanup date formats that specify the same field multiple times.
Browse files Browse the repository at this point in the history
One of the usages was almost always meant to be something else. Most commonly the format reuses "m" (minutes of hour) instead of "M" (month of year) or "s" (second of minute) instead of "S" (milliseconds).

Eg: "mm/dd/yyyy hh:mm:ss.sss" instead of "MM/dd/yyyy hh:mm:ss.SSS"

#busy-beavers

PiperOrigin-RevId: 571995047
  • Loading branch information
Material Design Team authored and drchen committed Oct 10, 2023
1 parent 93360a5 commit f1da3c3
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -231,13 +231,13 @@ public void textFieldPlaceholder_usesDefaultFormat() {

@Test
public void textFieldPlaceholder_usesCustomFormat() {
singleDateSelector.setTextInputFormat(new SimpleDateFormat("kk:mm:ss mm/dd/yyyy"));
singleDateSelector.setTextInputFormat(new SimpleDateFormat("kk:mm:ss MM/dd/yyyy"));
View root = getRootView();
((ViewGroup) activity.findViewById(android.R.id.content)).addView(root);

TextInputLayout textInputLayout = root.findViewById(R.id.mtrl_picker_text_input_date);

assertThat(textInputLayout.getPlaceholderText().toString()).isEqualTo("kk:mm:ss mm/dd/yyyy");
assertThat(textInputLayout.getPlaceholderText().toString()).isEqualTo("kk:mm:ss MM/dd/yyyy");
}

@Test
Expand Down

0 comments on commit f1da3c3

Please sign in to comment.