New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

greg-cal

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

greg-cal

A Collection of TypeScript utilities for implementing calendar and datepicker. Zero-dependency and lightweight (only 462B).

  • 1.0.4
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
127
decreased by-71.96%
Maintainers
1
Weekly downloads
 
Created
Source

Greg Cal

A Collection of TypeScript utilities for implementing calendar and datepicker. Zero-dependency and lightweight (only 462B).

Installation

Using yarn:

$ yarn add greg-cal

List of Utilities

1. getDates()

Get an array of calendar dates for a given month and year appended with empty dates to fill the days before the first calendar day.

Arguments

NameTypeDefault ValueDescription
yearstring or numberCalendar Year
monthnumberCalendar Month (0 - 11)
firstDayOfTheWeek"sun" or "mon""sun"First day of the week, "sun" for Sunday and "mon" for Monday

Returns

TypeDescription
Date[]Calendar dates

Example

getDates(2018, 8, 'mon');
// => [ null, null, null, null, null, 2018-08-31T17:00:00.000Z, 2018-09-01T17:00:00.000Z, ... ]

2. getDays()

Get all localized day names in a week.

Arguments

NameTypeDefault ValueDescription
localestring"en-US"Locale code (e.g. "en-US", "id-ID")
format"long" or "short""short"Day format
firstDayOfTheWeek"sun" or "mon""sun"First day of the week, "sun" for Sunday and "mon" for Monday

Returns

TypeDescription
string[]Day names

Example

getDays('en-US', 'short', 'mon');
//=> [ 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun' ]

3. getMonths()

Get all localized month names in a year.

Arguments

NameTypeDefault ValueDescription
localestring"en-US"Locale code (e.g. "en-US", "id-ID")
format"numeric", "2-digit", "long" or "short""long"Month format

Returns

TypeDescription
string[]Month names

Example

getMonths('en-US', 'short');
//=> [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ]

FAQs

Package last updated on 02 Aug 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc