0.0
No commit activity in last 3 years
No release in over 3 years
Extended methods for Date Class
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

Extended Date Class

Extended methods for Date class, to get first days of month (first sunday, first thursday etc.)

METHODS AVAILABLE:

Class Methods:

Date.first_day_of_month_for(dat,day)

  • dat can be, date object / date string
  • day can be, case insensitive string of weekdays / below mentioned numbers representing weekdays

Instance Methods:

first_day_of_month(day)

  • day can be, case insensitive string of weekdays / below mentioned numbers representing weekdays

We can use these below numbers as well for week days

  • sunday - 0
  • monday - 1
  • tuesday - 2
  • wednesday - 3
  • thursday - 4
  • friday - 5
  • saturday - 6

Usage

Instance Methods:

  • Date.today.first_day_of_month("sunday")
  • Date.today.first_day_of_month("MONDAY")
  • Date.today.first_day_of_month("3") --> returns first wednesday of the month
  • Date.today.first_day_of_month(6) --> returns first saturday of the month

Class Methods:

  • Date.first_day_of_month_for(Date.today,"3") --> returns first wednesday of todays month
  • Date.first_day_of_month_for("2012-03-15","wednesday") --> returns first wednesday of given day's month