Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Simple calendar support for python datetime.date
pip install calendarutil
)git clone "https://github.com/github-suraj/calendar-util"
)In this module, all the methods take input arguments as year
and month
.
>>> from calendarutil.month import util
>>> util.first_monday_of_month(2021, 4)
datetime.date(2021, 4, 5)
In this module, all the methods take input argument as year
.
>>> from calendarutil.month import from_year
>>> from_year.first_monday_of_month(2021)
[datetime.date(2021, 1, 4), datetime.date(2021, 2, 1), datetime.date(2021, 3, 1), datetime.date(2021, 4, 5), datetime.date(2021, 5, 3), datetime.date(2021, 6, 7), datetime.date(2021, 7, 5), datetime.date(2021, 8, 2), datetime.date(2021, 9, 6), datetime.date(2021, 10, 4), datetime.date(2021,
11, 1), datetime.date(2021, 12, 6)]
In this module, all the methods take input arguments as date object
for start
and end
date.
>>> from datetime import date
>>> from calendarutil.month import from_range
>>> dt1 = date(2021, 3, 1)
>>> dt2 = date(2021, 9, 1)
>>> from_range.first_monday_of_month(dt1, dt2)
[datetime.date(2021, 3, 1), datetime.date(2021, 4, 5), datetime.date(2021, 5, 3), datetime.date(2021, 6, 7), datetime.date(2021, 7, 5), datetime.date(2021, 8, 2), datetime.date(2021, 9, 6)]
In this module, all the methods take input arguments as year
and month
.
>>> from calendarutil.month import first_day_of_month
>>> first_day_of_month(2021, 5)
datetime.date(2021, 5, 1)
>>> from calendarutil.month import first_weekday_of_month
>>> first_weekday_of_month(2021, 5)
datetime.date(2021, 5, 3)
>>> from calendarutil.month import last_day_of_month
>>> last_day_of_month(2021, 2)
datetime.date(2021, 2, 28)
>>> from calendarutil.month import last_weekday_of_month
>>> last_weekday_of_month(2021, 2)
datetime.date(2021, 2, 26)
In this module, all the methods take input arguments as year
and quarter number
.
>>> from calendarutil.quarter import first_day_of_quarter
>>> first_day_of_quarter(2022, 1)
datetime.date(2022, 1, 1)
>>> from calendarutil.quarter import first_weekday_of_quarter
>>> first_weekday_of_quarter(2022, 1)
datetime.date(2022, 1, 3)
>>> from calendarutil.quarter import last_day_of_quarter
>>> last_day_of_quarter(2022, 4)
datetime.date(2022, 12, 31)
>>> from calendarutil.quarter import last_weekday_of_quarter
>>> last_weekday_of_quarter(2022, 4)
datetime.date(2022, 12, 30)
Give us a :star2: if this project helped you!
Copyright © 2021 Suraj Jaiswal
FAQs
Simple and lightweight calendar support for python datetime.date
We found that calendarutil demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.