Bug 115300 - date formula skips a month (same formula hasn't been ok till today)
Summary: date formula skips a month (same formula hasn't been ok till today)
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
5.3.4.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-29 15:30 UTC by Mark Mclean
Modified: 2018-01-29 16:03 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Mclean 2018-01-29 15:30:28 UTC
Description:
I have been using =DATE(YEAR(A1), MONTH(A1)+1, DAY(A1)), which adds one month to today's date. Has been working the last 6 or 8 months, but now it is skipping February and shows March! 

Steps to Reproduce:
1. =now()....in A1 And as today being Jan. 29
2.=DATE(YEAR(A1), MONTH(A1)+1, DAY(A1))This will skip a month and show March!
3.=MONTH(A1)This will show December!

Actual Results:  
Above

Expected Results:
above


Reproducible: Always


User Profile Reset: No



Additional Info:
[Information automatically included from LibreOffice]
Locale: en-US
Module: SpreadsheetDocument
[Information guessed from browser]
OS: Windows (All)
OS is 64bit: no


User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0
Comment 1 Xavier Van Wijmeersch 2018-01-29 15:52:33 UTC
confirm

Version: 5.3.1.2
Build ID: e80a0e0fd1875e1696614d24c32df0f95f03deb2
CPU Threads: 8; OS Version: Linux 4.14; UI Render: default; VCL: kde4; Layout Engine: new; 
Locale: nl-BE (en_US.UTF-8); Calc: group ==>

Version: 6.1.0.0.alpha0+
Build ID: 2d8f17565ebe867210f5769851d91b2e7b612a8f
CPU threads: 8; OS: Linux 4.14; UI render: default; VCL: kde4; 
Locale: nl-BE (en_US.UTF-8); Calc: group threaded
Comment 2 Mike Kaganski 2018-01-29 16:03:55 UTC
1. The formula has fundamental flaw. It takes today's year (2018), next month (2), and today's day (29), and combines into a date; Feb 29 2018 is one day after the actual last day in this year's February - so it is March 1st, which it properly shows.

2. When you take =MONTH(A1), where A1 is =now(), you get simply number 1. It is *NOT* a date, just a number. But if you will decide to format the cell with the 1 as date, you will get the date of LibreOffice base date (Options-LibreOffice Calc-Calculate) plus one day (i.e., Dec 31, 1899), so when you only show the month of that date, you rightfully get December.