Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

English ordinal suffix format option added as {S} #479

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

najicham
Copy link

@najicham najicham commented Oct 29, 2018

English ordinal suffix format option added as {S}. This adds a two character string to the end of the day such 1st, 14th, 22nd, 23rd.

Summary of changes

Dates can be easier to read sometimes when the ordinal suffix is added to the day of month. Such as:

  • February 22nd
  • March 10th
  • August 31st
  • October 3rd

Checklist

  • S format option added to the list in the default tokenizer module. Min/max width set to 2.
  • Directives module sets the :suffix type to use day_of_month parser, same as what day uses to check that the day of month is valid.
  • Formatter checks the padding and calls Timex.ordinal_suffix(date) to get the value.
  • Timex module defines a delegate for the ordinal_suffix function to use Timex.Protocol.
  • Each implementation of Timex.Protocol has a function named ordinal_suffix that determines the suffix. (naivedatetime.ex, datetime.ex, date.ex, erlang.ex)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant