Skip to content

Pendulum creation and transformation with datetime.date and datetime.time #82

@AndreasBackx

Description

@AndreasBackx

Currently the Pendulum supports creating from given hours, minutes... using:

  • Pendulum.create_from_date
  • Pendulum.create_from_time
  • Pendulum.with_date
  • Pendulum.with_time

These all however require you to pass the hours, minutes and more manually. It would be great if these accepted the datetime.date and datetime.time classes like so:

>>> import datetime
>>> from pendulum import Pendulum
>>> today_datetime = datetime.date.today()
>>> today_datetime
datetime.date(2016, 11, 26)
>>> today_pendulum = Pendulum.create_from_date(today_datetime)
>>> today_pendulum
<Pendulum [2016-11-26T00:00:00+01:00]>

Many libraries incorporate these classes and transforming them using Pendulum would be great.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions