Module:Citation/CS1: Difference between revisions
workaround for limitations of formatDate
m>Dragons flight  (merge from sandbox.  Removes unused functions (moved to Module:Citation) and updates page handling)  | 
				m>Dragons flight   (workaround for limitations of formatDate)  | 
				||
| Line 220: | Line 220: | ||
         return result;  |          return result;  | ||
     else  |      else  | ||
         return '';  |          --[[  | ||
        FormatDate fails on years that are less than 4 digits.  If the input   | |||
        is a positive integer, assume it is a valid year even if it has less   | |||
        than four digits.    | |||
        ]]  | |||
        local num = tonumber( str );  | |||
        if num ~= nil and num > 0 and num < 2100 and num == math.abs(num) then  | |||
            return str;  | |||
        else  | |||
            return '';  | |||
        end  | |||
     end  |      end  | ||
end  | end  | ||