diff --git a/app/src/main/java/com/example/citrusclient/views/CreateScheduleFragment.java b/app/src/main/java/com/example/citrusclient/views/CreateScheduleFragment.java index 4492728..91c1c43 100644 --- a/app/src/main/java/com/example/citrusclient/views/CreateScheduleFragment.java +++ b/app/src/main/java/com/example/citrusclient/views/CreateScheduleFragment.java @@ -134,16 +134,16 @@ Button endDateButton = view.findViewById(R.id.end_date_button); Button endTimeButton = view.findViewById(R.id.end_time_button); - startDateButton.setText(year + "/" + (month + 1) + "/" + day); + startDateButton.setText(year + "/" + String.format("%02d", (month + 1)) + "/" + String.format("%02d", day)); startTimeButton.setText("00:00"); - endDateButton.setText(year + "/" + (month + 1) + "/" + day); + endDateButton.setText(year + "/" + String.format("%02d", (month + 1)) + "/" + String.format("%02d", day)); endTimeButton.setText("23:59"); startDateButton.setOnClickListener(v->{ DatePickerDialog datePickerDialog = new DatePickerDialog(requireContext(), new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) { - String date = year + "/" + (month + 1) + "/" + dayOfMonth; + String date = year + "/" + String.format("%02d", (month + 1)) + "/" + String.format("%02d", dayOfMonth); startDateButton.setText(date); } }, year, month, day); @@ -163,7 +163,7 @@ DatePickerDialog datePickerDialog = new DatePickerDialog(requireContext(), new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) { - String date = year + "/" + (month + 1) + "/" + dayOfMonth; + String date = year + "/" + String.format("%02d", (month + 1)) + "/" + String.format("%02d", dayOfMonth); endDateButton.setText(date); } }, year, month, day); @@ -248,6 +248,8 @@ // String startDateTime = startDateButton.getText() + " " + startTimeButton.getText(); String endDateTime = endDateButton.getText() + " " + endTimeButton.getText(); + Log.i("lkjfda", startDateTime + ":" + endDateTime); + Log.i("lkjsa", "" + spinner.getSelectedItemPosition()); scheduleViewModel.createSchedule(accountId, year, month, day, token, title, startDateTime, endDateTime, spinner.getSelectedItemPosition()); ((MainActivity)getActivity()).backFragment(); });