Opened 3 years ago

Closed 3 years ago

## #993 closed defect (fixed)

# Relative dates can be incorrect due to daylight savings time

Reported by: | Nicklas Nordborg | Owned by: | Nicklas Nordborg |
---|---|---|---|

Priority: | major | Milestone: | Reggie v4.11.2 |

Component: | net.sf.basedb.reggie | Keywords: | |

Cc: |

### Description

The release exporter (#938) is exporting some dates as number of days relative a reference date. This was implemented in [4479]. If the two dates are spanning over the date that daylight savings time is activated the calculations become incorrect. The result is 1 day less than expected.

The reason is that the calculations are done via the "timestamp" representation of the date (eg. number of milliseconds since some day in 1970). Adjusting for daylight savings causes one day to only be 23 hours long. Our calculations simply round down to a whole number of days (expecting each day to be 24 hours).

**Note:**See TracTickets for help on using tickets.

(In [4570]) Fixes #993: Relative dates can be incorrect due to daylight savings time

This fixes the problem with the daylight savings time by adding an extra hour to all differences before calculating the number of days. It works as long as the values are date-only with time part set to 00:00:00, otherwise it may still produce results that are off by 1.