persistent class %Calendar.Hijri extends %Library.Persistent, %XML.Adaptor
SQL Table Name: %Calendar.HijriA %Calendar.Hijri object contains a sequence of monthly lunar observations that can be installed into a Cache process so that the $ZDATE[TIME][H](x,20,...) and $ZDATE[TIME][H](x,21,...) functions use those observations when computing Hijri dates.
Evaluating ##class(%Calendar.Hijri).%New(Name,Year,DateH,Months) produces a new Hijri Observation Calendar object with the the calendar name specified by the argument Name. The argument Year is the Hijri year number for the year containing the first 12 lunar observations. The argument DateH contains a Cache $HOROLOG date value specifying the first day of the first Hijri year containing observational data. The String Months contains the observations starting from the first month of Hijri year Year. If the length of Months string argument is not a multiple 12 then extra observations will be added to fill out to the end of the last year. These extra months will attempt to bring the last day of the Observed calendar years closer to the Tabular calendar. These supplied months can be changed in the future after the actual observations are available. A character in the string Months must be "0" if there is a lunar observation which ends the corresponding month on the 29th day. The character in the string Months must be "1" if there is no lunar observation on the 29th day of the month and that month instead has 30 days. No characters other than "0" and "1" are permitted in the Months string.
Note the description of the Delta property which keeps track of the difference between the Observational Calendar and the Tabular Calendar. When a %Calendar.Hijri is created (by the %New method) or is modified (by the AddObservation method), there is a restriction that the the difference between the Observed Calendar dates and the corresponding Tabular Calendar dates cannot be greater than 5 days apart. Such a difference between the Observed Calendar and the Tabular Calendar indicates an error in the observational data that is trying to become part of the %Calendar.Hijri object. An attempt to have a difference that is more than 5 days earlier or more than 5 days later means the new object will not be created or that an existing object will not be modified.
Users of the %Calendar.Hijri Class are encouraged to suggest improvements to InterSystems that could be added to this Class
The character "0" indicates a 29 day month; the character "1" indicates a 30 day month.
If the new Observation is being made to a month before Month 12 then AddNewObservation method will attempt to modify an observation in a month following the new Observation so that the Observed - Tabular difference at the end of the year is not changed.
You must have installed all the observations for the months of the last year before you use AddObservation to add an observations for a new, additional ending year. After a new year is added to the table of observations, the only way to modify any preceding year to to call ##class(%Calendar.Hijri).%New(Name,Year,DateH,Months) to in create a new object containing the modified observations. (Hint: If you want to keep the same name as an existing object then you must delete the existing object before creating a new object with the same name.)
Note: AddObservation just modifies the in-process copy of the Calendar. You must use the %Save method to save the modification back to your namespace. Also, AddObservation does not "install" your change into the process. You must use the InstallCalendar method to have the $ZDATE[TIME][H](x,20,...) or $ZDATE[TIME][H](x,21,...) functions start using the new observation.
Storage Model: CacheStorage (%Calendar.Hijri)