Page MenuHomePhabricator

[Lua task #11] Create a general date-handling function
Closed, DeclinedPublic


Prerequisite: To work on this task, you MUST have knowledge of Lua programming already, or another language plus Lua tasks 1-9 here in Google Code-in. You will need to learn about Lua patterns (similar to regular expressions).

Wikipedia sometimes get dates written in unusual styles. There are four generally useful styles that we want to standardise on:

  • dmy format, e.g. 22 December 2017
  • mdy format, e.g. December 22, 2017
  • iso format, e.g. 2017-12-22
  • y format, e.g. 2017

They may be used in different contexts in Wikipedia, so a general date-handling function should accept a parameter to specify what output is required. e.g. |dateformat=dmy. Those are the four basic formats that we want the function to output, as selected by dateformat.

The input should be a piece of text that may contain a date. There are some examples at User:RexxS/DateDataTest.

You can add to those that dmy dates and mdy dates may have a suffix, which may be any of "AD", "BC", "CE", or "BCE". You'll need to have another input parameter that specifies either the AD/BC or CE/BCE styles for output.

1 Create a sandbox section that collects as many different types of test cases as you can think of.

2 Create a function that will accept arbitrary text and extract from it a likely date, then output it in the selected format.

3 Test your function with all of your cases. Give a link here.

Event Timeline

RexxS created this task.Dec 22 2017, 3:36 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 22 2017, 3:36 PM
RexxS added a comment.Dec 22 2017, 3:36 PM

I will mentor this in Google-Code-in 2017.

Aklapper closed this task as Declined.Jan 17 2018, 6:28 PM

Closing this task as it was a placeholder in Phab for Google-Code-in-2017 which is ending these days (no more new tasks can be claimed from now on in GCI 2017).