gui-cs / Terminal.Gui

Cross Platform Terminal UI toolkit for .NET
MIT License
9.4k stars 676 forks source link

Jalaali(Persian) Date input support #1204

Open inamvar opened 3 years ago

inamvar commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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:

tig commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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

inamvar commented 3 years ago

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.