Bug 154721 - Jalali Calendar does not work correct in Libre office calc
Summary: Jalali Calendar does not work correct in Libre office calc
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.4.6.2 release
Hardware: All Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-08 20:48 UTC by Omid Alsharif
Modified: 2023-04-17 18:26 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
You can see incorrect day name in Persian of week and correct day name of week in English (15.99 KB, application/vnd.oasis.opendocument.spreadsheet)
2023-04-09 06:59 UTC, Omid Alsharif
Details
A1 and B2 Are today date (51.67 KB, image/png)
2023-04-10 07:44 UTC, Omid Alsharif
Details
A1 and B2 Are today date (20.34 MB, image/gif)
2023-04-10 08:33 UTC, Omid Alsharif
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Omid Alsharif 2023-04-08 20:48:51 UTC
Description:
When i insert Jalali date(Persian) in a cell that has Persian date format name of week is in correct .
for example today is 1402/01/19 and LibreOffice Calc say it is Thursday while today is Saturday 

Steps to Reproduce:
1.Set a cell format to date and language to Persian and set format to جمعه 31 اسفند 1999
2.enter Persian date in that cell for example 1402/01/19 and Enter button
3.resize cell to see result

Actual Results:
Incorrect day name of week

Expected Results:
Correct day name of week


Reproducible: Always


User Profile Reset: No

Additional Info:
[Information automatically included from LibreOffice]
Locale: en-US
Module: SpreadsheetDocument
[Information guessed from browser]
OS: Linux (All)
OS is 64bit: yes
Comment 1 m_a_riosv 2023-04-08 21:04:33 UTC
Please attach a sample file to test.
Comment 2 Omid Alsharif 2023-04-09 06:59:45 UTC
Created attachment 186548 [details]
You can see incorrect day name in Persian of week and correct day name of week in English
Comment 3 m_a_riosv 2023-04-09 21:45:51 UTC
Foremost, forgive me, I am not known about Persian and Persian calendar.

Let's see if someone else can confirm if there is an issue.
Comment 4 ady 2023-04-10 00:01:51 UTC
Without knowing specifics about Persian Calendar, here is the test I performed.

Starting with attachment 186548 [details] from comment 2, I added:

C1: =A1
D1: =B1

Then I Clear Direct Formatting on C1:D1 ([CTRL]+[M]).

The resulting values are different, which means those dates are not the same for Calc.

C1: -181861
D1: 45025

Then:

_ E1: =D1
_ Clone format from A1 to E1.

I copied the result from E1 to some translation web page, and the resulting translation to English was "Sunday, July 9, 2023", which is the same date and day of the week of B1.

Using the original text from A1 in the same translation web page, the result is "Friday, April 20, 1402".

Using the same serial number from C1, the result is "Fri, January 20, 1402", which is a different date than the translated text ("Friday, April 20, 1402").

We seem to have here a Gregorian vs Julian Calendar issue, before considering what is the date format for the cell and the corresponding calculation of the day of the week for a given date.

I think we need more info – I thought that the date was supposed to be the same in A1 and in B1 according to comment 0, but it's not – but we also need someone that understands the 3 different Calendars (or at least 2 of them) and how Calc deals with the '[NatNum1]NNNN""D MMMMYYYY' format.
Comment 5 Omid Alsharif 2023-04-10 07:44:08 UTC
Created attachment 186558 [details]
A1 and B2 Are today date

IN A1 Calc says Today is Saturday in Persian(شنبه) And In B2 Says Today Is Monday in Persian(دوشنبه)

days are not different in Two calendars 
only months and years are different
  


Date in A1 Is 1402/01/21
First month in Persian Calendar is "Faravardin"  In Persian(فروردین) (Current Month) 

Date in B2 Is 04/10/2023

I Found this website that helps you understand Persian Calendar

https://www.iranchamber.com/calendar/converter/iranian_calendar_converter.php
Comment 6 Omid Alsharif 2023-04-10 08:33:28 UTC
Created attachment 186559 [details]
A1 and B2 Are today date

You can watch this gif for more info
Comment 7 ady 2023-04-10 21:28:28 UTC
(In reply to Omid Alsharif from comment #6)
> Created attachment 186559 [details]
> A1 and B2 Are today date

In attachment 186548 [details], they are not the same date from the perspective of Calc.

In Calc, the serial number for the same date is expected to be the same, independently of the way/format they are displayed. As I explained in comment 4, they are not the same for Calc in attachment 186548 [details].

There might be a bug, but unfortunately I don't have the knowledge needed in order to determine whether there is one or not.
Comment 8 Omid Alsharif 2023-04-12 17:12:00 UTC
Hi 
I Find a bug in entire Libreoffice 

IF you use Insert date option to insert Persian Date to Document 
it returns year in Gregorian calendar and convert current Gregorian month to Persian Incorrectly and day of month remain what's current day is

for example Calc or Writer return 2023 as Current year while Current Persian Year is 1402
and return "تیر" as current month 4th month of Persian while current month is "فروردین" first month in Persian Calendar 
and return 12 as current day of month while today is 23


I think i can fix this bug if someone shows me that code related to Persian date format

I accept It as a code Challenge To start my Journey as a real programmer