Skip to content

Commit

Permalink
Fix: ParseException when parsing an empty date string
Browse files Browse the repository at this point in the history
  • Loading branch information
nqmgaming committed May 25, 2024
1 parent 893feec commit 09ee8f9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/com/nqmgaming/shoseshop/di/AppModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ object AppModule {
@Singleton
fun provideShoesApi(): ShoesApi {
return Retrofit.Builder()
.baseUrl("http://192.168.0.197:5555/")
.baseUrl("https://shoes-shop-api-unl0.onrender.com/")
.addConverterFactory(GsonConverterFactory.create())
.client(
OkHttpClient.Builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,11 @@ class SignUpActivity : AppCompatActivity() {
val address = binding.addressEt.text.toString().trim()
val phoneNumber = binding.phoneEt.text.toString().trim()
val birthDateInput = binding.dateEt.text.toString().trim()
val birthDate =
val birthDate = if (birthDateInput.isNotEmpty()) {
SimpleDateFormat("dd/MM/yyyy", Locale.getDefault()).parse(birthDateInput)
} else {
null
}
val formattedBirthDate = birthDate?.let { it1 ->
SimpleDateFormat(
"yyyy-MM-dd",
Expand Down

0 comments on commit 09ee8f9

Please sign in to comment.