Convert recording time relative to local timezone.

Convert recording time relative to local timezone and format it with
a easily readable format.
This commit is contained in:
0xboobface 2018-10-01 18:07:51 +02:00
parent 63a91b830d
commit 88ee4bd157
1 changed files with 12 additions and 1 deletions

View File

@ -9,6 +9,11 @@ import java.io.IOException;
import java.net.URL;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@ -31,6 +36,7 @@ import ctbrec.Recording.STATUS;
import ctbrec.recorder.Recorder;
import ctbrec.recorder.download.MergedHlsDownload;
import javafx.application.Platform;
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.concurrent.ScheduledService;
@ -93,7 +99,12 @@ public class RecordingsTab extends Tab implements TabSelectionListener {
name.setPrefWidth(200);
name.setCellValueFactory(new PropertyValueFactory<JavaFxRecording, String>("modelName"));
TableColumn<JavaFxRecording, String> date = new TableColumn<>("Date");
date.setCellValueFactory(new PropertyValueFactory<JavaFxRecording, String>("startDate"));
date.setCellValueFactory((cdf) -> {
Instant instant = cdf.getValue().getStartDate();
ZonedDateTime time = instant.atZone(ZoneId.systemDefault());
DateTimeFormatter dtf = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM, FormatStyle.MEDIUM);
return new SimpleStringProperty(dtf.format(time));
});
date.setPrefWidth(200);
TableColumn<JavaFxRecording, String> status = new TableColumn<>("Status");
status.setCellValueFactory((cdf) -> cdf.getValue().getStatusProperty());