ashkang / jcal

Jalali Calendar Library
http://nongnu.org/jcal
139 stars 24 forks source link

Gregorian weekday names vs Iranian month names #12

Closed reith closed 10 years ago

reith commented 10 years ago

libjalali uses two different conventions for naming months and weekdays simultaneously. In jtime.c I see month names as in Iranian calendar but weekdays named as Gregorian or Iranian when specified by fa prefix or suffix.

Operations dealing with implicit representation format, e.g. jasctime() or jstrftime's '%c' directive indicating preferred format, elect Gregorian weekday names but Iranian month names. This is counter-intuitive. I doubt it be even possible to get Gregorian month name by jstrftime with custom directives, so weekdays probably should be named similarly.

ashkang commented 10 years ago

Operations dealing with implicit representation format, e.g. jasctime() or jstrftime's '%c' directive indicating preferred format, elect Gregorian weekday names but Iranian month names.

You're right. %c directive must show Farsi weekday names instead of Gregorian and this is a bug. However, it is not currently possible to get Gregorian month names from libjalali, since there are no one-to-one mapping between them. January is by no means related to say Dey or Farvardin, but Saturday is Shanbeh from every perspective. When we're talking about the Gregorian month name of a given Jalali date, it has no meaning unless we're talking about date conversion. You have to convert a Jalali date to it's Gregorian representation first. But speaking of Gregorian weekday names still makes sense even without converting anything. I had some idea to bring Gregorian side by side with their Jalali representations in jcal, but as far as the library is concerned, I think conversion to Gregorian or vice-versa is another matter which at the moment can be easily achieved using libjalali and libc <time.h> family of functions. If we consider this as the whole map for date conversion: Jalali <--> time_t <--> Gregorian then libjalali is only responsible for this part: Jalali <--> time_t, whereas libc's mktime() family of functions is responsible for the other part: time_t <--> Gregorian. If you think we're talking about two distinct subjects, please elaborate and pinpoint the problem further with more details and examples. I have to admit that general definition for libjalali is quite vague and ambiguous.

reith commented 10 years ago

Well, That's correct. We really don't need to get Gregorian month names from libjalali functions because it simply doesn't make sense. I think calling weekdays by Iranian names as preferred and standard names would solve the problem.

ashkang commented 10 years ago

I think calling weekdays by Iranian names as preferred and standard names would solve the problem.

Previous commit fixes exactly that. If that's the case, it's safe to assume this issue is resolved and can be closed.

reith commented 10 years ago

Maybe it be better to affect jasctime and jctime too? Also, current manual pages contain an example of jctime invocation that produce output with Iranian weekday name.