Bug 158625 - Dateformat not preserved in calc
Summary: Dateformat not preserved in calc
Status: REOPENED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-10 11:05 UTC by Guus Ellenkamp
Modified: 2023-12-17 16:14 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Sample file (6.96 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2023-12-11 11:24 UTC, Guus Ellenkamp
Details
Screen shot (29.06 KB, image/jpeg)
2023-12-11 14:19 UTC, Guus Ellenkamp
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Guus Ellenkamp 2023-12-10 11:05:12 UTC
Description:
After saving a file the date format of cells that have a different date format are changed back to mm-dd-yy. Date format given: mm/dd/yy.

Cal version 7.4.0.2 (not shown in list below) on debian.

File format xlsx.


Steps to Reproduce:
1. Format cell to date format mm/dd/yy.
2. Save file.
3. Open file.
4. Date changed back to mm-dd-yy.

Actual Results:
Date format not saved.

Expected Results:
Date format preserved when saving.


Reproducible: Always


User Profile Reset: No

Additional Info:
Preserve the date format given.
Comment 1 m_a_riosv 2023-12-10 23:37:59 UTC
Works for me with:
Version: 24.2.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: 0ddd9f7e055a0c1ecb120de3e40c3fdb8373e9dc
CPU threads: 16; OS: Windows 10.0 Build 22631; UI render: Skia/Vulkan; VCL: win
Locale: es-ES (es_ES); UI: en-US Calc: CL threaded

Please attach a sample file, and paste the information in Menu/Help/About LibreOffice, there is an icon to copy.
Comment 2 Guus Ellenkamp 2023-12-11 11:24:38 UTC
Created attachment 191354 [details]
Sample file

As requested.
Comment 3 Guus Ellenkamp 2023-12-11 11:24:54 UTC
Version: 7.0.4.2
Build ID: 00(Build:2)
CPU threads: 4; OS: Linux 5.10; UI render: default; VCL: gtk3
Locale: en-PH (en_PH.UTF-8); UI: en-US
Debian package version: 1:7.0.4-4+deb11u7
Calc: threaded
Comment 4 m_a_riosv 2023-12-11 12:27:53 UTC
Those figures are not true spreadsheet dates but text dates.
Use Menu/Data/Text to column to convert them in true dates, and format as you like. Doing so works fine for me.
Comment 5 Guus Ellenkamp 2023-12-11 12:43:32 UTC
I don't get it. It doesn't work for me. I don't see a menu Data->Text. And whatever I do, the same thing happens.

Even if it is what you say it would still be a bug to me, as when I format a cell as a date with a specific format I would expect that format to be preserved.
Comment 6 m_a_riosv 2023-12-11 12:52:00 UTC
Liked you or not it is not a bug.
Your dates are text dates, so the cell format doesn't change how they are shown.

Select the range with dates.
Menu/Data/Text to column.
Click on data column head.
In column type, select DD/MM/YY.
Now change the format as you like. 

https://ask.libreoffice.org/t/date-format/37044
Comment 7 Guus Ellenkamp 2023-12-11 14:09:35 UTC
Same result. The format changes from mm-dd-yy to mm/dd/yy when using your suggestion, but after saving and closing and opening again the format changes back to mm-dd-yy.
Comment 8 Guus Ellenkamp 2023-12-11 14:19:50 UTC
Created attachment 191358 [details]
Screen shot

Now I got something weird. I changed some things cell by cell and the date format in the edit field is mm/dd/yy. But the date formats in some cells are mm-dd-yy. And the other fields are numbers now.
Comment 9 Guus Ellenkamp 2023-12-13 08:03:06 UTC
I have the same issue now also in other (older) files. Before that worked fine, so it must have to do with some update.
Comment 10 m_a_riosv 2023-12-13 21:46:26 UTC
Then please attach another sample file
Comment 11 ady 2023-12-13 23:18:41 UTC
(In reply to Guus Ellenkamp from comment #0)
> Steps to Reproduce:
> 1. Format cell to date format mm/dd/yy.
> 2. Save file.
> 3. Open file.
> 4. Date changed back to mm-dd-yy.

@Guus,

I am trying to reproduce your steps using your attachment 191354 [details] (an xlsx spreadsheet file), but I must be misunderstanding something.

When I open attachment 191354 [details] I see 2 worksheets. "Sheet2" has nothing relevant to this report. "Sheet1" has a list of dates.

The cells containing the dates are already formatted as "MM/DD/YY" and are displayed accordingly, meaning that there is nothing to initially change or re-format (trying to follow your steps), but rather save the file "as-is" (using a different name).

Saving the file with the same xlsx format (with a different name), closing and re-opening it, I still see the dates formatted as MM/DD/YY and displayed in the same way.

So, there is no "Date changed back to mm-dd-yy" (and it never was).

Perhaps we need more specific steps, and/or a different spreadsheet file. It is also possible that I am seeing different things than you are. Or maybe I am misunderstanding something.
Comment 12 Guus Ellenkamp 2023-12-17 02:36:09 UTC
Apparently you are seeing something else than I do. That's why I reported it as a bug as it seems to be related to a specific version.
Comment 13 m_a_riosv 2023-12-17 16:14:51 UTC
Maybe some direct format is producing the issue for you.
Clear the cell format with [Ctrl+M] and try again.