# Schedule invalid next action times when start time is in the future

**URL:** <https://community.temporal.io/t/schedule-invalid-next-action-times-when-start-time-is-in-the-future/12258>\
**Category:** Community Support\
**Tags:** java-sdk\
**Created:** [May 27, 2024, 6:30pm UTC](https://community.temporal.io/t/schedule-invalid-next-action-times-when-start-time-is-in-the-future/12258 "2024-05-27T18:30:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![luisfernandes](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/luisfernandes/32/5396_2.png) [@luisfernandes](https://community.temporal.io/u/luisfernandes)\
**Post date:** [May 27, 2024, 6:30pm UTC](https://community.temporal.io/t/schedule-invalid-next-action-times-when-start-time-is-in-the-future/12258/1 "2024-05-27T18:30:26Z")

</div>

Hi team,

If we create two similar schedules but set one to start only one hour from now, the `getNextActionTimes()` returns invalid values.

```auto
Instant now = Instant.now();

List<ScheduleCalendarSpec> calendarSpec = List.of(
    ScheduleCalendarSpec.newBuilder()
        .setSeconds(List.of(new ScheduleRange(now.atOffset(ZoneOffset.UTC).getSecond())))
        .setMinutes(List.of(new ScheduleRange(now.atOffset(ZoneOffset.UTC).getMinute())))
        .setHour(List.of(new ScheduleRange(0, 23)))
        .build());

System.out.println("Now: " + now);
for (int i = 0; i <= 1; i++) {
    scheduleClient.createSchedule("scheduleId" + i,
        Schedule.newBuilder()
            .setAction(action).setSpec(ScheduleSpec.newBuilder()
                .setStartAt(now.plus(i, ChronoUnit.HOURS))
                .setCalendars(calendarSpec).build()).build(),
        ScheduleOptions.newBuilder().build());
    System.out.println("Schedule " + i);

    scheduleClient.getHandle("scheduleId" + i).describe().getInfo()
        .getNextActionTimes().forEach(System.out::println);
}

```

Output of this code:

```auto
Schedule 0
2024-05-27T19:22:10Z
2024-05-27T20:22:10Z
2024-05-27T21:22:10Z
2024-05-27T22:22:10Z
2024-05-27T23:22:10Z
(...)
Schedule 1
2024-05-27T19:22:10Z
2024-05-27T19:22:10Z
2024-05-27T19:22:10Z
2024-05-27T19:22:10Z
2024-05-27T19:22:10Z
(...)

```

I would expect the hours for `Schedule 1` to start at `2024-05-27T20:22:10Z` and increment by one hour just like `Schedule 0`.  
Why does this happen? Is this a expected behaviour?

Thank you.
