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

Allow formatting of in_words #788

Open
2 tasks done
BrutuZ opened this issue Dec 30, 2023 · 0 comments
Open
2 tasks done

Allow formatting of in_words #788

BrutuZ opened this issue Dec 30, 2023 · 0 comments

Comments

@BrutuZ
Copy link

BrutuZ commented Dec 30, 2023

  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Feature Request

A format parameter in the in_words() function to allow limiting the units used.

Reasoning

Assuming a

dt = pendulum.duration(years=1, months=2, weeks=3, days=4, hours=5, minutes=6, seconds=7)

The current format for dt.in_words() (1 year 2 months 3 weeks 4 days 5 hours 6 minutes 7 seconds) can be too verbose for some use-cases where a more compact format would be more suitable, so I propose adding an optional format parameter for more granular control of units\fields.
That way, if we call it like dt.in_words(format='YMD') we'd get 1 year 2 months 25 days, dt.in_words(format='MDm') would result in 14 months 25 days 306 minutes and so on

@BrutuZ BrutuZ changed the title Allow formatting of ìn_words` Allow formatting of in_words Dec 30, 2023
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

No branches or pull requests

1 participant