Calender

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Calender

Peter Landgren

Hi all,

I'm planning to introduce another calender in GRAMPS. It's the Swedish which ran from 1700-03-01 and it was planned to end 1740, but the war stopped this and the calender ended already 1712-02-30, when the Julian calender was used from 1712-03-01 again.

I understand that i have to write two functions in calender.py:

swedish_sdn(year, month, day)

swedish_ymd(sdn)

There is one date that is not valid 1700-02-29

and one "new" date 1712-02-30, that is valid.

When Sweden converted to Gregorian 1753-03-01, the dates in the span 1753-02-18 - 1753-02-28 are also invalid.

So, you could say that the Swedish calender started 1700-03-01 and ended 1753-02-17 to include all date problems during this period.

I think I can fix the functions above, but where (and how) are the valid/not valid dates handled?

Comments

/Peter


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: Calender

jerome
> When Sweden converted to Gregorian 1753-03-01, the dates in the span
> 1753-02-18 - 1753-02-28 are also invalid.
>
> So, you could say that the Swedish calender started 1700-03-01 and ended
> 1753-02-17 to include all date problems during this period.
>
> I think I can fix the functions above, but where (and how) are the
> valid/not valid dates handled?

+1
I would like to know ...

French calendar started 1792-9-22 and ended 1806-01-01
I added changes which avoid date mistakes during convertion
(French_cal <-> Gregorian_cal)
http://www.gramps-project.org/bugs/view.php?id=445

Need to check _Date_fr (and properly implement) last changes on Calendar
and Date API (trunk). And to test calendar conversion on main Date
manager (english and template).


Peter Landgren a écrit :

>
>
> Hi all,
>
> I'm planning to introduce another calender in GRAMPS. It's the Swedish
> which ran from 1700-03-01 and it was planned to end 1740, but the war
> stopped this and the calender ended already 1712-02-30, when the Julian
> calender was used from 1712-03-01 again.
>
> I understand that i have to write two functions in calender.py:
>
> swedish_sdn(year, month, day)
>
> swedish_ymd(sdn)
>
> There is one date that is not valid 1700-02-29
>
> and one "new" date 1712-02-30, that is valid.
>
> When Sweden converted to Gregorian 1753-03-01, the dates in the span
> 1753-02-18 - 1753-02-28 are also invalid.
>
> So, you could say that the Swedish calender started 1700-03-01 and ended
> 1753-02-17 to include all date problems during this period.
>
> I think I can fix the functions above, but where (and how) are the
> valid/not valid dates handled?
>
> Comments
>
> /Peter
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Gramps-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gramps-devel



------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: Calender

Douglas S. Blank
In reply to this post by Peter Landgren
> Hi all,
>
> I'm planning to introduce another calender in GRAMPS. It's the Swedish
> which ran from
> 1700-03-01 and it was planned to end 1740, but the war stopped this and
> the calender ended
> already 1712-02-30, when the Julian calender was used from 1712-03-01
> again.
>
> I understand that i have to write two functions in calender.py:
> swedish_sdn(year, month, day)
> swedish_ymd(sdn)
>
> There is one date that is not valid 1700-02-29
> and one "new" date 1712-02-30, that is valid.
>
> When Sweden converted to Gregorian 1753-03-01, the dates in the span
> 1753-02-18 -
> 1753-02-28 are also invalid.
>
> So, you could say that the Swedish calender started 1700-03-01 and ended
> 1753-02-17 to
> include all date problems during this period.
>
> I think I can fix the functions above, but where (and how) are the
> valid/not valid dates
> handled?

Peter,

I'm definitely not an expert in the date parser, but I did just make some
changes there. I don't think that there are "invalid dates". It looks like
any date in one calendar can be translated into any date in another, but I
could be wrong.

You could make sure that a date doesn't end up mapping to a non-date or
force it inside the range when you convert, but you may lose information
that way. For example, if a year in Gregorian maps to a Swedish 1699 and
you "force" it to something else, then you won't be able to go back to the
proper Gregorian date.

If it doesn't exist, perhaps we need some "semantic" date error checking.
I think that there is a bug in the tracker because we crazy years, like
22323235235, which are syntactically correct, but not semantic or
meaningfully correct (unless, as Benny pointer out, you are writing
science fiction :) But that would be a new feature, I think.

-Doug

> Comments
>
> /Peter


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: Calender

Peter Landgren

Doug,

> I'm definitely not an expert in the date parser, but I did just make some

> changes there. I don't think that there are "invalid dates". It looks like

> any date in one calendar can be translated into any date in another, but I

> could be wrong.

My intention was to allow input of only valid dates for "Swedish Calendar period", like 1712-02-30..

> You could make sure that a date doesn't end up mapping to a non-date or

> force it inside the range when you convert, but you may lose information

> that way. For example, if a year in Gregorian maps to a Swedish 1699 and

> you "force" it to something else, then you won't be able to go back to the

> proper Gregorian date.

I think I can manage to covert to/from sdn as there is always a Julian/Gregorian date that maps to/from a Swedish date. The difference is only 1 day.

> If it doesn't exist, perhaps we need some "semantic" date error checking.

> I think that there is a bug in the tracker because we crazy years, like

> 22323235235, which are syntactically correct, but not semantic or

> meaningfully correct (unless, as Benny pointer out, you are writing

> science fiction :) But that would be a new feature, I think.

(It's a bug I reported. I have used that locally, so if that string consists of 8 digits like yyyymmdd and mm and dd are valid months and dates I put to "-" in the string and continue. This is very useful for me when I copy and paste dates from some applications that show dates like yyyymmdd.)

/Peter


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: Calender

Peter Landgren
In reply to this post by jerome

Jérôme,

Thanks, I will have a look at _Date_fr.py to see how you handle the situation there.

Maybe I need to come up with a "_display_swedish".

/Peter


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: Calender

jerome
Peter,

There was much groping to find the correspondence for dates !!!
If I remember well : I have printed SDN number and used a pseudo obvious
result for getting dates. After many tests, I found them !

> Maybe I need to come up with a "_display_swedish".

I think so, but maybe the same conversion error with dates before start
of calendar.

> where (and how) are the valid/not valid dates handled?

I just called invalid date when user tries to convert date before start
of french_calendar (ok, not very elegant ...)
Date will be a textual value.
Valid or textual dates full management was too complex for me...
So, I would like to understand too how this dates are handled.


Jérôme



Peter Landgren a écrit :

>
>
> Jérôme,
>
> Thanks, I will have a look at _Date_fr.py to see how you handle the
> situation there.
>
> Maybe I need to come up with a "_display_swedish".
>
> /Peter
>



------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel