23 | constructor | Initialiser ForceFlag | Overall constructor How the various initialisations are delegated Constructor +--_Reset +--From +--FromJulian +--From32Bits +--FromTimestamp +--FromString | +--FromYMDHMS | +--FromText +--FromDate +--FromDAYo +--FromArray _Sanitize |
1709 | AddDays | NoDays | add (-ve = subtract) a given number of days from a specific CAL date NK,EOT,BOT return themselves Anything else returns NV AR1 When adding days alone to a date: Count according to the real calendar. AR2 Use method a. *** If AR2b is required use Tinterval method *** 'D' |
1750 | AddMonths | NoMonths | add ( -ve = subtract ) specified number of months AR3: When adding months alone to a date: Convert the days part of the date into fractions of that month. Then add the months, carrying base 12 as required. Now convert the fraction back into days according to the actual length of the new month. May throw error if trying to add months to just a year but this will be ignored if NoMonths is a multiple of 12
|
1799 | AddYears | NoYears | add ( -ve = subtract ) specified number of years |
1587 | After | Aday | compares the logical values of the dates. Returns true if THIS is AFTER before ARGUMENT See Before() |
1303 | AsDays | Convert an interval into days Result may be fractional and negative | |
1552 | Before | Aday | compares the logical values of the dates. Returns true if THIS is DEFINITELY before ARGUMENT Note there are many cases where this test doesn't make sense or where the data cannot possibly be interpreted. All of these will return false without any error being raised. Therefore it is up to the programmer to avoid propagating spurious FALSEs by suitably guarding before calling. |
922 | BoT | Construct DAYo for Beginning of time | |
1504 | CalendarType | if this is a CAL then tell what type 0 .. fully specified DAYu.CALTYPE_YMD 000 1 .. no day DAYu.CALTYPE_YMX 001 3 .. just year DAYu.CALTYPE_YXX 011 7 .. not calendar DAYu.CALTYPE_ERR 111 These funny values are because we use them in various representations to mask components we don't use. A 1 bit signifies unused | |
835 | ClearWWWS | Clear .whatWentWrongStr | |
1633 | Contains | Aday | Return true if this date is the same as or encompasses the argument. This must have the same or lower precision than the argument. Possible combinations for sensible testing ------------------------------------------ CAL y m d - y m d y m 0 - y m d y 0 0 - y m d, y m 0 FLO 0 m 0 - 0 m d Unsuitable values return false not an exception |
1901 | DateToString | Template | return a string representation of a CAL or FLO The format string is a sequence of two-character tokens that describe the elements to be included in the output These may be interleaved with literal characters. The Day(number) and Month elements will normally automatically be exchanged to match the DM_ORDER parameter in the appendix. (can be disabled with the -S flag) CALENDAR DATE FORMATTING CODES ------------------------------ y1 ... year without any leading zeroes y2 ... 2-digit year y4 ... 4-digit year m1 ... 1 or 2-digit month number m2 ... 2-digit month number M2 ... Month name tiny M3 ... Month name short M4 ... Month name long d1 ... 1 or 2-digit day number d2 ... 2-digit day number D2 ... Day name tiny D3 ... Day name short D4 ... Day name long BC ... BC indicator FLAGS ------------------------------ -T ... Don't use 'Today' -E ... Add extended NV and NVI reasons -S ... Disable effect of DM_ORDER |
1261 | Day | return day element 0 implies not set | |
1344 | DayOfWeek | Day of week No date-day returns 0. Monday ... Sunday returns 1 ... 7 | |
1856 | DaysDifference | Aday | How many days difference |
1862 | DumpStr | Return string version of internal state for debugging | |
924 | EoT | Construct DAYo for End of time | |
1156 | FirstDay | return first specific day | |
1524 | FloatType | if this is floating then tell what type 6 .. Floating day DAYu.FLOTYPE_XXD 110 5 .. Floating month DAYu.FLOTYPE_XMX 101 4 .. Floating month-day DAYu.FLOTYPE_XMD 100 0 .. not floating DAYu.FLOTYPE_ERR 000 These funny values are because we use them in various representations to mask components we don't use. A 1 bit signifies unused | |
1248 | FractionOfMonth | How far through month are we? Might throw error if year needed for February and not given Only applicable to CALs of form y+m+d and m+d | |
68 | From | Initialiser ForceFlag | Try to load from given Initialiser Initialiser is a string, number, Date, Dayo or an array Sometimes a value could be interpreted in more than one way so ForceFlag may be used to clarify how the input is to be interpreted - String See documentation for details. OPTIONALLY USE ForceFlag as follows: None Default Guess from pattern matching DAYu.forceYMD ... Ignore H:M:S elements of Unix timestamp DAYu.forceYMDHMS ... uses H:M:S elements of Unix timestamp - Number --> From32Bits() OPTIONALLY USE ForceFlag as follows None Default ... assume input is a 32-bit number DAYu.force32Bits ... Force 32 bit conversion DAYu.forceJulian ... Julian day DAYu.forceTimeStamp ... UNIX timestamp - undefined,false and null ==> NV and no error - DAYo object - Date object Same ForceFlag options as string - Array of 'Signature,Sign,y,m,d,Errorcode' (Throws error string if any duff parameters) Return false if the Initialiser was readable but gave strange values
|
797 | From32Bits | UnsignedInt | Read native 32-bit format Sets DAY from number bits 31 - 29 Signature bits 28 Sign 0:-ve 1:+ve bits 27 - 16 Year 0 ... 4095 bits 15 - 12 Month 1:Jan ... 12:Dec 0 is legal bits 11 - 7 Day of month 1 ... 31 0 is legal bits 6 - 3 Day of week (Fully specified) 1:Mon ... 7:Sun 0:Undefined Not valid reason code (NV) See table 7 bit 3 Not used bit 2 Valid flag 1:Is validated bit 1 Fully specified 1:Is fully specified bit 0 Interval 1:Is interval Doesn't sanitize |
144 | FromArray | Ay | Ay is of the form 'Signature,Sign,Y,M,D,Error code' Does not sanitize |
129 | FromDAYo | DayObj | Clone a DAY object |
190 | FromDate | JsDate UseTimeBits | Use a Javascript Date object to populate ourselves JsDate is a Javascript Date object UseTimeBits is a boolean flag to tell if the HMS part is to be used for rich dates. This would be false or missing for fully specified dates (ie. where Y,M and D are all valid). Note that if H,Mins,S are all 0 it is automatically treated as a simple YMD case.
|
159 | FromJulian | Julian | Set ourselves from a Julian day number Does not sanitize |
111 | FromString | Str ForceFlag | Str is either some sort of human input like '23 May 2014' or YYYY-MM-DD or YYYY-MM-DD HH:MM:SS The optional ForceFlag can be used to use or ignore the HH:MM:SS part of the timestamp If the HMS part is present and ForceFlag is DAYu.strYMDHMS then use the overloaded/encoded time elements to create a rich DAYo |
257 | FromText | Str | Read an ordinary human style text input
|
176 | FromTimestamp | UnixMilliseconds UseTimeBits | UnixMilliseconds is a standard UNIX timestamp Optional UseTimeBits is for when you can't use native 32-bit format Really a wrapper for .FromDate() |
527 | FromYMDHMS | Str UseTimeBits |
|
838 | GetErrorCode | what is the numerical value of the error | |
833 | GetWWWS | Get .whatWentWrongStr | |
1010 | HasDay | Return true if the day component is specified | |
1007 | HasMonth | Return true if the month component is specified | |
1013 | HasYear | Return true if the year component is specified | |
1016 | IsBC | Return true if the sign component is negative | |
948 | IsBoT | Test for BoT signature | |
983 | IsCalendar | Is this a calendar day of the form Y or YM or YMD | |
951 | IsEoT | Test for EoT signature | |
978 | IsErrorFree | True if there is no error reported | |
969 | IsFloating | Test for a FLO signature | |
956 | IsGiven | Test for a signature indicating a workable date ie. NK, BoT, Cal or EoT | |
994 | IsGoodCalendar | MonthRequired DayRequired | Is it error-free and a calendar day with specified precision MonthRequired and DayRequired are boolean flags |
960 | IsKnown | Test for signature indicating a 'known' date. ie. BoT, Cal or EoT | |
945 | IsNotKnown | Test for NK signature | |
973 | IsRealPeriod | Test for a real date which could be Y or YM ie. Day component is missing | |
748 | IsSameValue | DAYobj StrictFlag | ============================================ See if two DAYs have the same value If StrictFlag is truthy then errorCodes must match as well. ============================================ |
964 | IsSpecific | Is this a Cal that referrs to a specified day. ie. Day, month and year components are all specified | |
1025 | IsToday | Return true if this is today | |
937 | IsValid | Does DAYo have a valid signature This does not mean free from errors See IsErrorFree() and IsGoodCalendar() | |
942 | IsValidDate | Test for a valid DAYo signature This does not mean free from errors See IsErrorFree() and IsGoodCalendar() | |
1330 | Julian | Julian() Return Julian day number * VERY IMPORTANT FUNCTION * Returns iNV if not a fully specified date | |
1159 | LastDay | return last specific day | |
1170 | Middle | Middle date of a range | |
1272 | Month | return month element 0 implies not set | |
1850 | MonthsDifference | Aday | How many months difference |
926 | NK | Construct DAYo for Not known | |
928 | NV | Construct DAYo for Not Valid | |
1165 | Next | return next Same sort of period | |
1162 | Previous | return previous Same sort of period | |
769 | SetYear | Year | Set Year and deal with negative values |
1295 | Signature | returns signature (integer) | |
1484 | SortsBefore | Aday | Does this DAYo sort before the DAYo in the argument (Intervals sort by magnitude, everything else by 32-bit representation.) |
1369 | To32Bits | To32Bits() Returns an unsigned number bits 31 - 29 Signature bits 28 Sign 0:-ve 1:+ve bits 27 - 16 Year 0 ... 4095 bits 15 - 12 Month 1:Jan ... 12:Dec 0 is legal bits 11 - 7 Day of month 1 ... 31 0 is legal bits 6 - 3 Day of week (Fully specified) 1:Mon ... 7:Sun 0:Undefined Not valid reason code (NV) See table 7 bit 3 Not used bit 2 Valid flag 1:Is validated bit 1 Fully specified 1:Is fully specified bit 0 Interval 1:Is interval | |
1458 | ToDate | return a fully encoded Javascript Date H, m and s are encoded | |
1205 | ToString | Arg1 Arg2 | ToString('Template','ExtendErrorCodeFlag') Default string representation. • Template (string) : See .DateToString() for template details and options • ExtendErrorCodeFlag (boolean) : Missing/False->Number code True->String messages |
1400 | ToYmdhms | ResultType | ToYmdhms(ResultType) Depending on the ResultType argument this can return 'ARRAY' an array encoded the form 'y,m,d,h,m,s' 'DATE' a javascript Date object with h,m,s encoded 'YMDHMS' a string formatted as yyyy-mm-dd hh:mm:ss 'YMDTHMSZ' a string formatted as yyyy-mm-ddThh:mm:ss.000Z 'STAMP' Unixy timestamp version of DATE (milliseconds since January 1, 1970, 00:00:00 UTC -ve for prior)
|
920 | Today | Construct DAYo for Today | |
1282 | Year | returns a signed year number or 0 if not set | |
1843 | YearsDifference | Aday | How many years difference |
1317 | _FloatingMetric | Internal function that returns a simple metric 'day count' 32 * days + months Only applicable to floats | |
2053 | _LimitChars | Num Padding | Turn a string into a number with 0,2 or 4 zeros padding Padding should be 0, 2 or 4 |
731 | _Matches | ArrayOfInnerValues | _Matches Tests internal structure against supplied array 'Signature,Sign,y,m,d,errorCode' |
1042 | _RangeEnd | BegOrEnd |
|
32 | _Reset | Reset all internal values | |
628 | _Sanitize | _Sanitize Private method to ensure internal values are safe If any errors then sanitize them and set signature to NV Return false if any errors found Tell error to .whatWentWrongStr | |
472 | _SetCalHelper | Y M D | We've got a d,m and y to process to finish |
446 | _SetFloatHelper | M D | We've got a float, so finish it off. The patterns are (0,day),(month,0),(month,day) |
884 | _SetFloats | PartialMask | Zero any of the Y M D values in a Flo according to The three-bit PartialMask If PartialMask is invalid or not a Flo then return false Typical use is when masking during an input conversion Return false if an issue |
518 | _SetNvHelper | Code Desc | We've got an error so set this to not valid Code is a DAYu error code Desc is an optional txt message to go into what went wrong (See ._WWWS) |
848 | _SetPartials | PartialMask | Zero any of the Y M D values in a Cal according to The three-bit PartialMask If PartialMask is invalid or not a Cal then return false Typical use is when masking during an inout conversion Return false if an issue |
831 | _SetWWWS | NewErrorStr | Add error message to .whatWentWrongStr NewErrorStr should be of the form: 'current routine' message |
1093 | _Step | BegOrEnd |
|
42 | BADFROMFORMAT | 1, | weird input to a .From...() method |
43 | BADFROMVALUE | 2, | some value to a .From...() method is unsuitable |
22 | BoT | 5, | beginning of time |
106 | CALTYPE_ERR | 7, | types of calendar dates |
107 | CALTYPE_YMD | 0, | fully specified ->>PRECISION_DAY->>3 |
108 | CALTYPE_YMX | 1, | no day (M+Y) ->>PRECISION_MONTH->>2 |
109 | CALTYPE_YXX | 3, | just year ->>PRECISION_YEAR-->1 |
79 | CONV_STATUS_INVALIDEXT | 1, | Invalid extension found in t/stamp or date |
80 | CONV_STATUS_NOT_FULL_DATE | 2, | Conversion failure of some sort |
23 | Cal | 6, | Calendar date |
675 | Convert2to4DigitYear | Year,BlockFlag | Given the supplied two digit year convert it into a 4 digit year using the rules given by the TWO_DIGIT_FIX setting. 0 = Disallow 20 = convert yy -> 20yy 50 = convert yy so that it lies between 50 years ago and 50 years ahead If the argument <0 or TWO_DIGIT_FIX = 0 then return 0 If the argument is already 4 digits then leave it alone Year can be a string (preferable) as this helps weed things like 0067 which is 0067 not 2067 etc Optional BlockFlag returns the number without any conversion To call from inside DAYo use (this.sign==DAYu.neg) returns 0 if fail/disallow |
127 | DAYSINMONTH | 30.4375, | 365.25 / 12 |
54 | DFS_STATUS_ALPHANOTUNDERSTOOD | 3, | alpha isn't shortcut or month name |
57 | DFS_STATUS_CANTDECODEDDMMYY | 5, | 2,4,6 or 8 digits only |
49 | DFS_STATUS_EMPTYSTRING | 1, | all whitespace |
53 | DFS_STATUS_MORETHANONEALPHA | 2, | only 1 alpha token allowed |
52 | DFS_STATUS_NOTOKENS | 2, | no alpha numerics in string |
48 | DFS_STATUS_OK | 0, | |
50 | DFS_STATUS_TOOLONG | 1, | sanity limit of 40 characters (far more than needed) |
51 | DFS_STATUS_TOOMANYTOKENS | 2, | max 6 tokens (far more than needed) |
59 | DFS_STATUS_UNKNOWNERROR | 7, | Sanitize failure |
58 | DFS_STATUS_UNSUITABLENUMBER | 6, | unsuitable numeric value somewhere |
55 | DFS_STATUS_YEARMISSINGORBAD | 4, | missing or bad year |
56 | DFS_STATUS_YEARNOT2OR4DIGITS | 4 , | year must be yy or yyyy |
347 | DayCountToYmdIntArray | DayCount | DayCount is a number of days (Not necessarily an integer) Return an array of 'Y,M,D' after applying the necessary conversions Uses the fractional conversion factor DAYu.DAYSINMONTH |
332 | DayOfMonthToFraction | Y,M,D | How far through the month is this d/m/y? Can throw error if year is missing |
415 | DaysDifference | Aday1,Aday2 | Number of days between date1 and Date2 Example : If D1 is '1 Jan 2001' and D2 is '2 Jan 2001' then result is +1 Uses Julian day subtraction |
307 | DaysInGivenMonth | M,Y | How many days in given month? If m is 2 then use (optional) y to tell us if it is a leap year If y is 0 then it is not a leap year Illegal m argument or m=2 and y=undefined throws an error |
572 | EarliestFinish | ArrayOfCals,IgnoreUnsuitable | What is the earliest finish of these dates? Only Cals are suitable values for the array. NVI,INT,NV,FLO will throw an exception NK,BoT,EoT will NORMALLY throw an excepton UNLESS the optional 2nd arg is set true when NK->NK,EoT->EoT and BoT ignored Zero-length array throws an exception |
536 | EarliestStart | ArrayOfCals,IgnoreUnsuitable | What is the earliest start date of these dates? Only Cals are suitable values for the array. NVI,INT,NV,FLO will throw an exception NK,BoT,EoT will NORMALLY throw an excepton UNLESS the optional 2nd arg is set true when NK->NK,BoT->BoT and EoT ignored Zero-length array throws an exception |
24 | EoT | 7, | End of time |
20 | FLO | 3, | floating date |
103 | FLOTYPE_ERR | 2, | error |
102 | FLOTYPE_XMD | 4, | month and day only |
101 | FLOTYPE_XMX | 5, | month only |
100 | FLOTYPE_XXD | 6, | types of floating date |
76 | FTS_STATUS_INVALIDSIG | 1, | Error codes for FromTimestamp & date |
339 | FractionToDayOfMonth | Y,M,Fraction | Inverse of dayOfMonthToFraction() |
272 | GetDefaultYear | return the default year Use IMPLIED_YEAR to tell us what to do return iNV if missing years are not allowed IMPLIED_YEAR ... Return 0 ........ iNV Do not allow inputs that miss out year part. Return iNV -1 ........ yyyy Use the current year -2 ........ 0 Allow floating date input nnnn ........ nnnn Use the specified year Possible returns are iNV,0,yyyy | |
66 | IFS_STATUS_BADLENGTH | 1, | too short or too long |
68 | IFS_STATUS_NOTOKENS | 2, | Must have at least one part |
65 | IFS_STATUS_OK | 0, | |
71 | IFS_STATUS_SIGNMISPLACED | 5, | + or - other than at start |
69 | IFS_STATUS_SIGNMISSING | 3, | must start with + or - |
67 | IFS_STATUS_TOOMANYTOKENS | 2, | Can only have three parts |
70 | IFS_STATUS_UNKNOWNUNIT | 4, | suffix not recognised |
72 | IFS_STATUS_UNSUITABLENUMBER | 6, | unsuitable numeric value somewhere |
18 | INT | 1, | Interval |
115 | INTTYPE_D | 3, | precise to day (same as PRECISION_DAY) |
112 | INTTYPE_DDD | 0, | types of interval precision |
114 | INTTYPE_M | 2, | precise to month (same as PRECISION_MONTH) |
116 | INTTYPE_X | -1, | error |
113 | INTTYPE_Y | 1, | precise to year (same as PRECISION_YEAR) |
289 | IsLeapYear | Y | Is a given year a leap year? |
248 | JulianToCal | Julian | |
226 | JulianToYMD | Julian | Split Julian day number into array 'of Y,M,D' It may throw an exception through an unsuitable input (2436064 = 13/08/57) * SEE ALSO JulianToCal() * |
560 | LatestFinish | ArrayOfCals,IgnoreUnsuitable | What is the latest finish of these dates? Only Cals are suitable values for the array. NVI,INT,NV,FLO will throw an exception NK,BoT,EoT will NORMALLY throw an excepton UNLESS the optional 2nd arg is set true when NK->NK,EoT->EoT and BoT ignored Zero-length array throws an exception |
548 | LatestStart | ArrayOfCals,IgnoreUnsuitable | What is the latest start date of these dates? Only Cals are suitable values for the array. NVI,INT,NV,FLO will throw an exception NK,BoT,EoT will NORMALLY throw an excepton UNLESS the optional 2nd arg is set true when NK->NK,BoT->BoT and EoT ignored Zero-length array throws an exception |
645 | MonthOnly | Aday | Return a DAYo with just the month component |
448 | MonthsDifference | Aday1,Aday2 | calculate (or approximate if days are involved) the number of months difference. (Date2 - Date1) Arguments must have the same pattern of y/m/d components and be CAL or FLO. Cal y m d, y m 0 or y 0 0 FLO 0 0 d, 0 m 0 or 0 m d |
21 | NK | 4, | date not known |
19 | NV | 2, | Not a date value |
136 | NVD_INT_MULTINEGATIVE | 1, | Not valid details ---day--- ---date--- ---int--- |
17 | NVI | 0, | Invalid interval |
83 | NVR_FUNCTION_FAILURE | 7, | Not valid reasons |
84 | NVR_NOT_CONCURRENT | 8, | '@' change to 1..7 |
122 | PRECISION_DAY | 3, | fully specified |
119 | PRECISION_ERR | -1, | types of precision NB The greater the value the more precise |
121 | PRECISION_MONTH | 2, | only to months |
120 | PRECISION_YEAR | 1, | only to years |
130 | SECONDSPERDAY | 864000, | eg (J - UNIXDAYSTOJULIAN) * 86400 -> U |
151 | SigToStr | Sig | Signature code to three character string |
161 | SignToStr | Sign | Sign to three character string |
393 | SortsBefore | Day1,Day2 | Compare two DAYo objects If both are intervals then compare magnitude otherwise compare on 32 bit representation Return -1 d1 < d2 0 d1 == d2 +1 d1 > d2 (Note this is SIMILAR but not identical to DAYo.SortsBefore() which conflates == and > into false.) |
128 | UNIXDAYSTOJULIAN | 2440587, | Number to add to Unix day number to get Julian day number |
141 | UNIX_BOT | -2147540400, | 13 Dec 1901 05:00:00 |
142 | UNIX_EOT | 2147410800, | 18 Jan 2038 07:00:00 |
140 | UNIX_NK | -2147544000, | 13 Dec 1901 04:00:00 |
139 | UNIX_NV | -2147551200, | special values for unix timestamps |
61 | UNKNOWNERROR | 7, | Sanitize failure |
176 | YMDToJulian | Yr,Mo,Dy | Create Julian day number from Year, month and day Year can be +ve or negative Warning: No sanity checking of arguments is done |
491 | YearsDifference | Aday1,Aday2 | Practically the same as MonthsDifference / 12 except - unsuitable args returns iNV - where CAL pattern is y 0 0 the calculation is simple subtraction. |
713 | _Div | a,b | Utility integer division function |
580 | _EarliestLatestAnyAll | Caller,ArrayOfCals,IgnoreUnsuitable | Internal servicing method for Earliest/Latest Any/All Caller is two character code eg EF for EarliestFinish |
739 | _IsAlpha | Str | returns true if Str is all alpha |
744 | _IsNumeric | Str | returns true if Str is all numbers |
724 | _PadInt | LeftPadChr,Num,Width,Zero | Utility pad-right for integer LeftPadChr is typically 0 or space Num is numeric value Width is total width (Grows by 1 if Num is -ve) Zero is an optional substitute character for 0 |
374 | _StepYear | Year,Increment | Step year up or down but trap year 0 |
38 | badNumber | 6, | FromJulian() |
36 | badSetObject | 2, | DAYo.Set() given inappropriate object |
35 | badSetSignature | 1, | DAYo.Set() given inapropriate signature |
31 | canNeverHappen001 | -1, | Dayo.Set() |
95 | force32Bits | 103, | |
94 | forceJulian | 101, | |
96 | forceYMD | 104, | |
97 | forceYMDHMS | 105, | |
91 | iNV | -9999999, | integer not valid return value iNV |
27 | neg | 0, | sign negative |
32 | noError | 0, | |
28 | pos | 1, | sign positive |
37 | unsuitableRange | 3, | DAYo.Middle() on inapropriate object |
14 | version | "Built on {{BUILDDATE}}", | placeholder modified by build-tools |
150 | AllowDayOnlyIntervals | NewValBool | Do we allow INTs to be created with more than 31 days eg +0y 0m 66d |
135 | AllowExcessDaysInMonth | NewValBool | Get/Set true if we allow silent coercing of slightly too many days in month to end of month |
192 | BCIndicator | String used to indicate negative years @@@ needs to rewritten as get/set | |
263 | BuildCommonTerms | We need to look up shortcuts quite often for inputs so build A list of shortcuts (eg B for BoT) and other terms such as Beg-of-time | |
247 | BuildInputHacks | Create a lookup dictionary to allow some inputs to be converted to other (more acceptable ones) | |
283 | BuildMonthLookups | We're quite likely going to need to look-up month names As with Common Terms we need a shortest version and a full version for different ways of matching | |
431 | DumpCfg | Diagnostic for useful parameters usually pertaining to input strings | |
419 | ExtendedErrorStr | Sig,Err | return error string if applicable |
460 | INITIAL_DATA | [ | Default, built-in en-gb settings |
164 | ImpliedYear | NewValInt | Get/Set numeric value of IMPLIED_YEAR Allowable inputs are 0,-1,-2 or a year > 999 |
453 | InYearLimits | Year | Check to ensure the year given is within current limits. Only applies to INT and Cal |
61 | Initialise | OptionalAppendixData | Load the appendix file with the UI settings Must be done early on Returns false if there is an error OptionalAppendixData is text in appendix format @@@ We need another method such as GetAppendix(appx-name) as a wrapper That will be file getting and asynch :( |
312 | InterpretString | InpStr | Interpret string Return '' or 0 for not understood Return 'BoT','EoT','NK','NV','TODAY','NVI' if found Return month number |
121 | IsDmyOrder | NewValBool | Get/Set true if we are working in a d-m-y environment Always returns boolean' Only changed if NewValBool is of type boolean |
7 | KV | new Dict(), | |
102 | Lookup | Str,Num | Lookup a key The args may be just a string or a string and number eg ('BoT',3) |
410 | MonthName | MonNum,Version | Convert month number into a name MonNum 1..12 Version 1..4 (2 is 3 characters length) |
365 | SearchMonths | InpStr | Search month names to return a numeric equivilent eg Fe -> 2 Return a numeric equivilent or 0 if not found |
330 | SearchShortcuts | PossibleShortcutStr | Search shortcuts to return a string code eg "BoT" Return null string for not found |
347 | SearchTerms | PossibleTerm | Look to see if PossibleTerm might be start of a standard term For example PT=Be ST=Beg-of-Time -> "BoT" returns key string or null string |
110 | SetKeyValue | Key,Value | Temporaraly (session) set a K-V pair in the configuration Preferably use one of the direct convenience methods |
178 | TwoDigitFix | NewValInt | Get/Set numeric value of TWO_DIGIT_FIX Allowable inputs are 0,20,50 |
203 | _ExtractAppxSettings | AppxFileData,FirstLoad | (private) Read appendix file data. Sets .error to null string if OK |
85 | _Rebuild | ||
9 | appendix | "en-gb.dax", | actual file name |
8 | error | '', | eg load issue such as badly formatted file |
12 | force2or4DigitYears | false, | if true then years input MUST be in the form yy or yyyy |
10 | i18n | "i18n", | path (no trailing slash) to appendix |
49 | inputHacks | new Dict(), | AltStr -> NormalStr (all u/case) |
11 | intervalRegEx | /^([-\+])((\D*(\d+)([ymd])){1,3})/i, | This is an interval DETECTOR. ie. All must match |
48 | months1 | new Dict(), | July ->4 |
47 | months32 | new Dict(), | Jy ->4 Jul->4 |
46 | months4 | new Dict(), | These are the officialy approved strings that represent special terms allowed for input of BoT,EoT,NK,NV,NVI,TODAY. (Match if term starts with input.) |
13 | needsBuild | true, | flag if needs to be initialised |
39 | shortcuts | new Dict(), | B->BoT,E->EoT etc |
43 | specialTerms | new Dict(), | shortcuts are the shortest string that identifies a special term eg E for EoT These are generated from the .3 items in section 1 of the appendix for BoT,EoT,NK,NV,NVI,TODAY. (Match if input starts with shortcut) |
14 | yearLimit | 4095, | Maximum size of year |
13 | constructor | Initialiser | Standard constructor Initialiser can be an array See .FromArray() a number See .From32Bits() a string See .FromString(); a DAYi object to create a clone |
439 | AsDays | Convert an interval into days Result may be fractional and negative | |
322 | ClearWWWS | Clear .whatWentWrongStr | |
422 | Day | Returned UNSIGNED number of days. This might be >31 NOTE Always ise this when accessing the 'd' element as we may be storing a number of days. NOTE This is not the same as AsDays(); | |
462 | DumpStr | ||
111 | From | Initialiser | Try to load from given Initialiser Return false if the Initialiser was readable but gave strange values
|
278 | From32Bits | UnsignedInt | Read native 32-bit format Sets DAY from number bits 31 - 29 Signature 0:NVI 1:INT bits 28 Sign 0:-ve 1:+ve bits 27 - 16 Years 0..4095 bits 15 - 12 Months 0..11 bits 11 - 7 Days 0..31 bit 6 (not used) bits 5 - 3 Interval precision code (DAYu.INTTYPE_...) bits 2 - 0 Error code 0..7
|
32 | FromArray | DayArray | The lowest level 'constructor', all the other From() methods feed into this. Initialiser is an array 'Signature,Sign,Years,Months,Days,ErrorCode'; .Signature must be DAYu.INT or DAYu.NVI .Sign must be DAYu.pos or DAYu.neg .Years , .Months and .Days may be 0,-1 or a sensible value -1 is used to indicate missing. For example a string of "+1y 2m" would have a -1 for .Days. This important for precision For example "+1y 2m" is precice to month but "+1y 2m 0d" is precise to day .ErrorCode is ignored unless .Signature is NVI
|
137 | FromString | IntStr |
|
325 | GetErrorCode | what is the numerical value of the error | |
320 | GetWWWS | Get .whatWentWrongStr | |
329 | HasDay | ||
328 | HasMonth | ||
330 | HasYear | ||
452 | IsSmallerThan | AnInterval |
|
327 | IsValid | ||
417 | Month | ||
101 | Precision | The .Precision() of an interval tells which of d, m or y it is accurate to This is nearly but not quite the same as .Type() qv. | |
253 | SetYear | Year | Set Year and deal with negative values |
82 | Sign | ||
81 | Signature | ||
303 | To32Bits | ||
351 | ToString | ForceFull | Creates a string something like +1y 2m 3d Used without argument (or if ForceFull is falsey) missing elements will be left out. So this can result in outputs such as +2m The default operation is not to show elements of greater precision than of the interval. So yearly precision drops the m and y parts. Intervals stored as days only are displayed as +123 etc. Use ForceFull to always show all elements. This can help to make it clearer to read columns etc. The year will normally have a single digit and the m and d fields two so that in general columns are likely to line-up. NOTE When ForceFull is used with a day-only interval it will be displayed in a y-m-d format with excess days being converted to months and years. This is only for display, the actual value of the DAYi object is not affected. |
95 | Type | The .Type() of an interval can be INTTYPE_DDD : Days are stored as-is without converting to months/years INTTYPE_Y : precise to year INTTYPE_M : precise to month INTTYPE_D : precise to day IMPORTANT .Type() gives the underlying storage method while .Precision() returns the same value for INTTYPE_DDD and INTTYPE_D | |
410 | Year | returns a SIGNED year number | |
71 | _Reset | ||
203 | _Sanitize | _Sanitize Private method to ensure internal values are safe If any errors then sanitize them and set signature to NV Return false if any errors found Tell error to .whatWentWrongStr | |
61 | _SetDDD | Days | |
318 | _WWWS | NewErrorStr | Add error message to .whatWentWrongStr NewErrorStr should be of the form: 'current routine' message |
19 | constructor | Exp Act | ~~~~~~~~~~~~~ Used by library methods ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Stack expected and actual results NB Don't forget to do Exp='' afterwards |
10 | constructor | Haystack Needle | ~~~~~~~~~~~~~ Used by library methods ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ case insensitive string comparison |
351 | AddBadTestResult | LineNum,Task,Expected,Actual,Comment | will be obs |
359 | AddCommentResult | Comment | |
355 | AddGoodTestResult | LineNum,Task,Expected,Actual,Comment | will be obs |
645 | AddLibraryTest | TestName,Desc,InpArg,OutArg,FunCode | Add a test function to the library TestName will be capitalised Desc is description/purpose (Any authoring/versioning stuff will be comments in the code calling this. InpArg and OutArg describe the sort of input, ie bit in the brackets of a test line, and nature of expected result. FunCode is the actual code NOTE We use the variable DAYx.__FILE__ to inject the source file name This is normally set/cleared by the methods loader. |
312 | AddResult | Ok,TestData,Result,Comment | Add an entry to the results file Ok is boolean or array of 'Ok,TestData,Result' |
818 | AjaxForFiles | Path,Ext,ThenDo | Look for a list of files using AJAX call Path is relative eg './tests/scripts' Extension is type of file incl dot eg .testScript ThenDo is a function taking an array of filenames which have had their extensions removed *NOTE* Browser only |
837 | AjaxLoadMethodFiles | look in the methods directory for js files each should have one or more methods implemented by AddLibraryTest(). All these are eval-ed so as to populate the method library ---------------------------------------------------------- | |
44 | DayDisplay | D | ============================================= Return HTML for the inner state of the DAYo object ============================================= |
624 | DescribeLibraryTests | InHtml | List the tests in the library If InHtml is truthy then return a string of TRs else an array of 'Name,Desc,Input,Output,Filename' |
673 | DoTestLine | TestData | ============================================= TestData is 'TestName,Function arguments,Expected result string,Comment' Do the appropriate test and add to results ============================================= |
89 | ErrorCodeToText | ErrCode | ============================================= Return the text representation of the ErrorCode(number) ============================================= |
369 | GetNextTestLine | ============================================= Looks for the next line in the tests that contains an actual test. Return null if 'EOF' or array 'TestName,Function arguments,Expected result string,Comment' ============================================= | |
160 | InitAtSubstitutions | set @TODAY and @YEAR substitutions ---------------------------------- | |
301 | Output | Label,Values | Send debugging information to results listing Can be toggled by the .showOutput property Label is a string Values is an array of bits to show |
109 | RunTestsInBrowser | FileName | ============================================= BROWSER MAIN CALL Load the file of tests into an array of lines tests'n' will be the nth line of the file Uses jQuery ============================================= |
173 | RunTestsInNode | FileName,Fs,Path | ============================================= NODE MAIN CALL FileName is relative to current dir Fs is fs (file system) variable Path is path utility ============================================= |
68 | SigToText | Signature | ============================================= Return the text representation of the signature(number) ============================================= |
758 | TestDateBothWays | TestData | ============================================= Implements the DATEBOTHWAYS test ============================================= |
458 | TestResultsTable | ShowAll | ============================================= Returns HTML for a table of results (BROWSER) ============================================= |
784 | TestSetConfig | TestData | ============================================= Implements the SETCONFIG command (Not actually a test) Normal use : SETCONFIG(KEY,VALUE) Can be used for functions eg SETCONFIG(SetLimitToUnixExtended) ============================================= |
709 | TestTwoWays | Day | This combines to/from js Date, to/from 32bits, to/from extended unix the result is ok or D, 3, U! being the first failure in the both ways We have this as a general add-on to the other tests so we get lots of coverage We expect these to be pretty reliable... OK Hope... OK wish :) |
434 | Wrap | S,Width | |
594 | _Bar | Text,Width | pad/truncate cell value and add a leading bar |
552 | _DumpResultsToFile | ShowAll | Writes results to file. either <script>.fails or <script>.results depending on ShowAll Filename is in 1st line testResults Node only |
420 | _ErrorPlace | Ex | Return string giving line and file where exception happened *** (Probably FF only. Alternatives at http://eriwen.com/javascript/js-stack-trace/) |
613 | _UnZero | NumStr | Utility function to drop trailing decimal zeroes from a number-string. "123.000" --\> "123" "123.400" --\> "123.4" |
232 | _UpdateOverview | update the collection of statistics This is an HTML file with links to results Node only | |
34 | __FILE__ | '', | Used when reading-in methods |
32 | atToday | '', | substitution for @TODAY |
33 | atYear | '', | substitution for @YEAR |
35 | firstLine | 1, | |
30 | glines | '', | temp |
36 | lastLine | 9999, | |
24 | libMethods | {}, | library of available tests |
31 | scriptName | '', | full name of file being used |
39 | showOutput | true, | show results of .Output() |
28 | testFailCount | 0, | |
29 | testPassCount | 0, | |
27 | testResults | [], | results of tests |
26 | tests | [], | definition of test |