Skip to content

DateUtils (addToDate): compute day offset in local time manner.

Kazuhiko Shiozaki requested to merge addToDate_implicit_localtime into master

if timezone is Europe/Paris, we expect :

'2021/03/28' + 1 day => '2021/03/29 GMT+1', NOT '2021/03/29 GMT+2.

i.e. 'same time' in the next day.

'2021/03/28' + 3 hours => '2021/03/28 04:00 GMT+2', NOT '2021/03/28 03:00 GMT+1'.

i.e. valid timezone offset at the result time.

because of lacking such support, we need to write very dirty code like the following :

begin_next_month = DateTime((addToDate(DateTime(now.year(), now.month(), 1), month=1) + 0.5).strftime('%Y/%m/%d'))

instead of :

begin_next_month = addToDate(DateTime(now.year(), now.month(), 1), month=1)

Merge request reports