Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jalaali(Persian) Date input support #1204

Open
inamvar opened this issue Apr 12, 2021 · 6 comments
Open

Jalaali(Persian) Date input support #1204

inamvar opened this issue Apr 12, 2021 · 6 comments
Labels
design Issues regarding Terminal.Gui design (bugs, guidelines, debates, etc...) enhancement

Comments

@inamvar
Copy link

inamvar commented Apr 12, 2021

It's good to support Jalaali(Persian) date. User can input date text in Jalaali and DateFiled should parse it to Georgian date. it's very useful feature for users that using Jalaali calendar system.

@tig
Copy link
Collaborator

tig commented Apr 13, 2021

I know nothing about Persian date formats.

Is there no built-in capability in .NET for handling them? In reviewing the PR for this (#1205) I see you've added a specific flag to the API. On the surface, this appears clunky to me.

Are you sure there's no way to add this support in a way that would ALSO add support for any other important but less common date input formats?

What we want to avoid is having the API need to support more and more flags like this over time. If Persian is the only outlier that requires this then I'm all for the solution you've provided!

@inamvar
Copy link
Author

inamvar commented Apr 14, 2021

I know nothing about Persian date formats.

Is there no built-in capability in .NET for handling them? In reviewing the PR for this (#1205) I see you've added a specific flag to the API. On the surface, this appears clunky to me.

Are you sure there's no way to add this support in a way that would ALSO add support for any other important but less common date input formats?

What we want to avoid is having the API need to support more and more flags like this over time. If Persian is the only outlier that requires this then I'm all for the solution you've provided!

You can learn about Persian date here. more that 150 millions people are using this calendar. As I know there is no built-in input for that in .NET and just has a PersianCalendar class that converts Georgian date into Persian date but no input control is available.

There are there common formats for calendar system:

  • Georgian
  • Hijri (Arabic lunar calendar)
  • Jalaali (Persian solar calendar)

I agree that is not a good way to set a flag for each type of format. I can change it to new class and call it 'PersianDateField' but it needs to be derived from DateField class and override some of it's methods. the problem is DateField methods are not virtual and can not be overridden. do you have any idea to ignore flag parameter?

@tig
Copy link
Collaborator

tig commented Apr 14, 2021

Got it.

I imagine over time there may be more controls that take date input/display dates...

I wonder if we should add a flag to a base class, e.g. View that gets set once to indicate Persian date formatting is in use. This could also be set automatically if it's possible to detect the user's computer-wide settings?

Now that I mention it, are you sure there's no way to detect this is a user's preference?

@inamvar
Copy link
Author

inamvar commented Apr 15, 2021

Got it.

I imagine over time there may be more controls that take date input/display dates...

I wonder if we should add a flag to a base class, e.g. View that gets set once to indicate Persian date formatting is in use. This could also be set automatically if it's possible to detect the user's computer-wide settings?

Now that I mention it, are you sure there's no way to detect this is a user's preference?

I think it's possible to detect system settings, but the point is 99% of people do not change OS settings to enter a Persian date. it's because of incompatibility of other Persian programs or etc.. for example my windows calendar setting is Georgian date but in my accounting software I enter date in Jalaali format. I don't want to change my hole system setting just for an accounting software.

@BDisp
Copy link
Collaborator

BDisp commented Apr 15, 2021

How about to add a custom date format property in the DateField view?

@inamvar
Copy link
Author

inamvar commented Apr 17, 2021

How about to add a custom date format property in the DateField view?
it's not only about date format string. the calendar system also should change. for example date format yyyy-MM-dd will be used in both Georgian and Jalaali systems.

@tig tig added design Issues regarding Terminal.Gui design (bugs, guidelines, debates, etc...) enhancement labels Apr 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design Issues regarding Terminal.Gui design (bugs, guidelines, debates, etc...) enhancement
Projects
Status: No status
Development

No branches or pull requests

3 participants