Fix: ajuste de horarios +2 horas para Argentina (v10.0.6)
This commit is contained in:
@@ -8,8 +8,8 @@ android {
|
||||
applicationId "com.streamplayer"
|
||||
minSdk 21
|
||||
targetSdk 33
|
||||
versionCode 100500
|
||||
versionName "10.0.5"
|
||||
versionCode 100600
|
||||
versionName "10.0.6"
|
||||
buildConfigField "String", "DEVICE_REGISTRY_URL", '"http://194.163.191.200:4000"'
|
||||
}
|
||||
|
||||
|
||||
@@ -127,6 +127,8 @@ public class EventRepository {
|
||||
|
||||
JSONArray array = new JSONArray(json);
|
||||
List<EventItem> events = new ArrayList<>();
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm");
|
||||
|
||||
for (int i = 0; i < array.length(); i++) {
|
||||
JSONObject obj = array.getJSONObject(i);
|
||||
String title = obj.optString("title");
|
||||
@@ -135,8 +137,20 @@ public class EventRepository {
|
||||
String status = obj.optString("status");
|
||||
String link = obj.optString("link");
|
||||
String normalized = normalizeLink(link);
|
||||
|
||||
// Ajustar hora: la web muestra hora de España, Argentina es +2 horas
|
||||
String displayTime = time;
|
||||
try {
|
||||
if (time != null && !time.isEmpty()) {
|
||||
LocalTime localTime = LocalTime.parse(time.trim(), formatter);
|
||||
LocalTime adjustedTime = localTime.plusHours(2);
|
||||
displayTime = adjustedTime.format(formatter);
|
||||
}
|
||||
} catch (DateTimeParseException ignored) {
|
||||
}
|
||||
|
||||
long startMillis = parseEventTime(time);
|
||||
events.add(new EventItem(title, time, category, status, normalized, extractChannelName(link), startMillis));
|
||||
events.add(new EventItem(title, displayTime, category, status, normalized, extractChannelName(link), startMillis));
|
||||
}
|
||||
return Collections.unmodifiableList(events);
|
||||
}
|
||||
@@ -167,9 +181,11 @@ public class EventRepository {
|
||||
try {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm");
|
||||
LocalTime localTime = LocalTime.parse(time.trim(), formatter);
|
||||
// Ajustar hora: la web muestra hora de España, Argentina es +2 horas
|
||||
LocalTime adjustedTime = localTime.plusHours(2);
|
||||
ZoneId zone = ZoneId.of("America/Argentina/Buenos_Aires");
|
||||
LocalDate today = LocalDate.now(zone);
|
||||
ZonedDateTime start = ZonedDateTime.of(LocalDateTime.of(today, localTime), zone);
|
||||
ZonedDateTime start = ZonedDateTime.of(LocalDateTime.of(today, adjustedTime), zone);
|
||||
ZonedDateTime now = ZonedDateTime.now(zone);
|
||||
if (start.isBefore(now.minusHours(12))) {
|
||||
start = start.plusDays(1);
|
||||
|
||||
Reference in New Issue
Block a user