Home
Random
Recent changes
Special pages
Community portal
Settings
About Porn Base Central
Disclaimers
Porn Base Central
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:GetBirthDate
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local p = {} local PBD = require('Module:PBD') local function splitDate(date) local day, month, year = nil, nil, nil if date then day, month, year = string.match(date, '(%d+)%s+(%a+)%s+(%d+)') if not year then month, day = string.match(date, '(%a+)%s+(%d+)') if not day then day, month = string.match(date, '(%d+)%s+(%a+)') end end if not month and not day then year = string.match(date, '(%d+)') end end if day then day = tonumber(day) end if year then year = tonumber(year) end return day, month, year end local function monthToNumber(month) local monthNames = { ["January"] = 1, ["February"] = 2, ["March"] = 3, ["April"] = 4, ["May"] = 5, ["June"] = 6, ["July"] = 7, ["August"] = 8, ["September"] = 9, ["October"] = 10, ["November"] = 11, ["December"] = 12 } return monthNames[month] end function p.property(frame) local propertyId = frame.args[1] local part = frame.args[2] local format = frame.args[3] or 'number' local date = PBD.property(frame, propertyId) local day, month, year = splitDate(date) local result = '' if part == 'day' and day then result = day elseif part == 'month' and month then if format == 'name' then result = month else result = monthToNumber(month) end elseif part == 'year' and year then result = year end return result end return p
Summary:
Please note that all contributions to Porn Base Central may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Porn Base Central:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Preview page with this template
Template used on this page:
Module:GetBirthDate/doc
(
view source
)