[Libreoffice] I need some advice to fix fdo#40363
Eike Rathke
erack at redhat.com
Wed Nov 30 03:10:39 PST 2011
Hi Jean-Baptiste,
On Tuesday, 2011-11-29 00:35:46 +0100, Eike Rathke wrote:
> > I do not understand why every dates before 1582-10-15 should not be
> > valid when only dates from 1582-10-05 to 1582-10-14 do not exist due to
> > the switch from julian calendar to gregorian calendar.
>
> Well, the Date class was never declared to work with dates earlier than
> when the Gregorian calendar sprang into existence ;-)
>
> > Now, my question is what to do? Is it a good idea to modify
> > Date::IsValid in tdate.cxx without knowing why it works in LibO 3.3 ?
>
> I don't think so. More promising probably would be to switch to a real
> calendar.. I may take a stab at that. But first investigate how Chart
> and Calc interface there.
I took a different approach. Actually the Date class implements
a proleptic Gregorian calendar, not having a gap between those Gregorian
cut-off dates, which in fact eases things a lot and is valid even in the
context of ISO 8601 and ODF. Chart did the IsValid() loop to find
a valid date after, for example, date particles 2011-02-31 were set, to
reach a valid 2011-02-28, but was "surprised" by the Gregorian check. So
I implemented Date::Normalize() and used that for the Chart needs.
I also renamed Date::IsValid() to Date::IsValidAndGregorian() to clarify
and added Date::IsValidDate() that does not check for the Gregorian
cut-off date.
In case you're interested:
http://cgit.freedesktop.org/libreoffice/core/commit/?id=dca69d5bb2d0e542de26624dd9f71fb87e1533f2
http://cgit.freedesktop.org/libreoffice/binfilter/commit/?id=1f9150ab1bbb121c59014fba7c7cd229aceeeb66
http://cgit.freedesktop.org/libreoffice/core/commit/?id=2b2f6abfcc83c4701b42c92c6209a1052324f0a5
http://cgit.freedesktop.org/libreoffice/core/commit/?id=6619955e72c1c2f29a32e82478d19147c0d7610a
http://cgit.freedesktop.org/libreoffice/core/commit/?id=07a7b2937a9427b2feb3307804ec0f527091bb92
Also fixed the misrepresentation of years<1000 with less than 4 digits
in the file format and enabled reading dates with less than 4 digits in
the year, so reading the original testcase document produces the desired
result:
http://cgit.freedesktop.org/libreoffice/core/commit/?id=7613359985a89a42417a746bcdbb25f072784733
Eike
--
LibreOffice Calc developer. Number formatter stricken i18n transpositionizer.
GnuPG key 0x293C05FD : 997A 4C60 CE41 0149 0DB3 9E96 2F1A D073 293C 05FD
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20111130/79da0a81/attachment.pgp>
More information about the LibreOffice
mailing list