Bug 150062 - Calc Csv import unable to import as date a column with dash separator , ok with slash
Summary: Calc Csv import unable to import as date a column with dash separator , ok wi...
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.3.4.2 release
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-19 13:04 UTC by Nicolas R
Modified: 2022-07-20 10:44 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file (758 bytes, text/plain)
2022-07-19 13:06 UTC, Nicolas R
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolas R 2022-07-19 13:04:52 UTC
Description:
When importing a csv file with calc, you can specify import format for some columns/fields of csv file.
From version 7.3.x ( tested with 7.3.4 French), for a field formatted as YYYY-MM-DD , even if you specify "date YMD", the import is made as text column.
It's ok with YYYY/MM/DD field ( slash separator instead of dash) or YYYY.MM.DD (dot separator).

Regression , because it's was ok in version 7.2.7 ... and annoying because YYYY-MM-DD is a very common date format while exporting from a database.

Language settings are the same in 7.3.4 and 7.2.7, especially "Date acceptance patterns : D/M/Y;D/M;D.M.Y;D-M-Y"

Steps to Reproduce:
With import_dash.csv file attached to this bug report : 
1. with open csv file with a date field formatted with dash separator
2. specify the field as date in the text import dialog
3. the field / column is imported as text


Actual Results:
2022-06-11

Expected Results:
11/06/2022  ( french date format, 'cause french version of Libreoffice.


Reproducible: Always


User Profile Reset: No



Additional Info:
Import process should be able to judge dash as a correct separator to import date field ( was ok in version 7.2.7 and previous).

Version: 7.3.4.2 (x64) / LibreOffice Community
Build ID: 728fec16bd5f605073805c3c9e7c4212a0120dc5
CPU threads: 12; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: fr-FR (fr_FR); UI: en-GB
Calc: CL
( UI temporarily in en-GB to have english version of menu entry. )
Comment 1 Nicolas R 2022-07-19 13:06:51 UTC
Created attachment 181332 [details]
Example file
Comment 2 Nicolas R 2022-07-19 13:43:02 UTC
Oups, it seems to be more subtle.

Actually 'YYYY-MM-DD' formatted field is directly imported as a date cell even without specifying "date YMD' in import dialog.... but the resulting date cell is formatted yyyy-mm-dd which is one of the proposed date format. Then you can change the cell format to any date format.

Other format 'yyyy/mm/dd' or 'yyyy.mm.dd' must be specified as date ymd during import and the resulting column/cell is formatted as dd/mm/yy ( default date format for french LibO version).

So , not really a bug but a new behavior during text import process.
Comment 3 Mike Kaganski 2022-07-19 13:54:16 UTC
(In reply to Nicolas R from comment #0)
> From version 7.3.x ( tested with 7.3.4 French), for a field formatted as
> YYYY-MM-DD , even if you specify "date YMD", the import is made as text
> column.

The sample you provided imports as dates using Version: 7.4.0.1 (x64) / LibreOffice Community
Build ID: 43e5fcfbbadd18fccee5a6f42ddd533e40151bcf
CPU threads: 12; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: en-US (ru_RU); UI: en-US
Calc: CL

> Actual Results:
> 2022-06-11
> 
> Expected Results:
> 11/06/2022  ( french date format, 'cause french version of Libreoffice.

But I can see it importing as 2022-06-11, *just the same way as it did in 7.2* - because 2022-06-11 is *not* a text, but a *very special*, ISO-standardized, date format - so LibreOffice implicitly recognizes it, even when it's not in the date acceptance patterns, and importing it, LibreOffice *takes care to keep the ISO format* (just because it's the only universally recognizable, unambiguous, date representation).

Can you check if it is really a text for you - such as, when you select a cell with the "2022-06-11", the status bar displays empty "sum" and "average" - or does it display also "2022-06-11", indicating that the data is recognized as a date? Or you may use View->Value Highlighting (Ctrl+F8), and check if the cells are colored blue (indicating the numeric/date content), or black (which stands for text)?
Comment 4 Mike Kaganski 2022-07-19 13:55:54 UTC
(In reply to Nicolas R from comment #2)

Aha. In fact, as I wrote, I doubt it's new in 7.3 - because it worked that way also before. But maybe it differed in some specific cases (like some specific locales or specific settings selected in import dialogs ...)
Comment 5 Nicolas R 2022-07-20 10:34:49 UTC
(In reply to Mike Kaganski from comment #4)
> (In reply to Nicolas R from comment #2)
> 
> Aha. In fact, as I wrote, I doubt it's new in 7.3 - because it worked that
> way also before. But maybe it differed in some specific cases (like some
> specific locales or specific settings selected in import dialogs ...)

I confirm that for me, it's new in 7.3. In 7.2.7 (exact version with locales below) , "2022-06-11" was imported as text ... if you don't specify date YMD during import (confirm with sum/avg or Ctrl-F8). And when you specify "date ymd" during import there is an "auto-format" in imported cells with "dd/mm/yy" => 11/06/22.
As in 7.3 this auto-format also happens for 2022/06/11 or 2022.06.11 ( with "date ymd" during import), but not for "2022-06-11" ... at first sight, I thought it was imported as text ....

So this auto-recognized date during import is rather an enhancement than a bug. 


Sorry for this (no) bug entry. I think you can close it !


Version: 7.2.7.2 (x64) / LibreOffice Community
Build ID: 8d71d29d553c0f7dcbfa38fbfda25ee34cce99a2
CPU threads: 12; OS: Windows 10.0 Build 19044; UI render: Skia/Vulkan; VCL: win
Locale: fr-FR (fr_FR); UI: fr-FR
Calc: CL