Skip to content

Commit

Permalink
feat: added DateTimeHelper to convert current date in ISO format
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikunj-Aggarwal committed Jan 7, 2025
1 parent f7d0fd5 commit f6d191e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/org/schabi/newpipe/error/ErrorActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
import org.schabi.newpipe.BuildConfig;
import org.schabi.newpipe.R;
import org.schabi.newpipe.databinding.ActivityErrorBinding;
import org.schabi.newpipe.util.DateTimeHelper;
import org.schabi.newpipe.util.Localization;
import org.schabi.newpipe.util.ThemeHelper;
import org.schabi.newpipe.util.external_communication.ShareUtils;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -107,7 +107,7 @@ protected void onCreate(final Bundle savedInstanceState) {

// important add guru meditation
addGuruMeditation();
currentTimeStamp = CURRENT_TIMESTAMP_FORMATTER.format(LocalDateTime.now());
currentTimeStamp = DateTimeHelper.currentDateToIsoDateFormat();

activityErrorBinding.errorReportEmailButton.setOnClickListener(v ->
openPrivacyPolicyDialog(this, "EMAIL"));
Expand Down
20 changes: 20 additions & 0 deletions app/src/main/java/org/schabi/newpipe/util/DateTimeHelper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.schabi.newpipe.util;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public final class DateTimeHelper {
private static final String TAG = DateTimeHelper.class.getSimpleName();

private DateTimeHelper() {
//no instance
}

/**
* @return the current date in ISO format.
*/
public static String currentDateToIsoDateFormat() {
final LocalDateTime currentDate = LocalDateTime.now();
return currentDate.format(DateTimeFormatter.ISO_DATE_TIME);
}
}

0 comments on commit f6d191e

Please sign in to comment.