This library provide a fast and easy way to work with date.

Overview

Calendar.js

Calendar.js provide a fast way to work with dates when you don't wanna deal with hours, minute, second and so on. It means that Calendar.js comes in handy when you wanna work with something like a 'calendar based app' or maybe you need some locally date system for a browser game.The Class is really easy-to-use: once you had import the module, instantiate a calendar object, set a year range and you get a json with a ordered list containing all the days belonging to those years.


Import

You have a couple of way to import the package:

Copy the raw js

The simplest way is to grab the raw js from https://github.com/ActuallyNotaDev/Calendar.js/blob/main/calendar.js, make a new js file, paste it. after that from your entry script:

import calendar from '<PATH>/calendar.js';

var ๐Ÿ“… = new calendar()

Via npm

npm package will be avabile soon


Usage

calendar use a ๐Ÿ“….set( first_year, last_year ) function to inizialize a calendar that goes from one year(first_year) to another(last_year). Once done you can quickly get your calendar.

// let's get the calendar from 1987 to 1997
๐Ÿ“….set( 1987, 1999 )

console.log(console.log(`this is the calendar from 1987 to  1999` ); )
console.log(๐Ÿ“….getCalendar())

The output, if you are testing on a browser should be like this:

Now each listed object rappresent a year with all his days also in the form of a list:

Get a specific day

At this point we can point to a certain position to get a specific day:

console.log(`The PlayStation is launched by Sony in Japan ๐ŸŽฎ : ` );
๐Ÿ“….pointDay(12,3,1990)

console.log(๐Ÿ“….getPointedDay());

Output:

browse between days

Passing an Int the function below provide a more declarative way to move the pointer:

console.log(๐Ÿ“….addDays(10)); 
console.log(๐Ÿ“….subDays(3));

Output :


RoadMap ๐Ÿš€

  • Add a getToday method
  • Add a getCurrentWeek method
  • Add a getPointedWeek
  • Add a addWeek and subWeek
You might also like...

Lightweight and simple JS date formatting and parsing

fecha Lightweight date formatting and parsing (~2KB). Meant to replace parsing and formatting functionality of moment.js. NPM npm install fecha --save

Jan 5, 2023

Reusable date picker component for React

React DayPicker DayPicker is a reusable date picker component for React. $ npm install react-day-picker@next Beta version โš ๏ธ This branch is for the ne

Dec 28, 2022

DEPRECATED: Timezone-enabled JavaScript Date object. Uses Olson zoneinfo files for timezone data.

TimezoneJS.Date A timezone-enabled, drop-in replacement for the stock JavaScript Date. The timezoneJS.Date object is API-compatible with JS Date, with

Nov 20, 2022

Date() for humans

date Date is an english language date parser for node.js and the browser. For examples and demos, see: http://matthewmueller.github.io/date/ Update: d

Jan 4, 2023

A lightweight, locale aware formatter for strings containing unicode date tokens.

Date Token Format A lightweight (~2kB), locale aware formatter for strings containing unicode date tokens. Usage Install the package using: yarn add d

Dec 24, 2021

Nepali Date Picker jQuery Plugin ๐Ÿ‡ณ๐Ÿ‡ต

Nepali Date Picker Nepali Date Picker jQuery Plugin for everyone. ๐Ÿ‡ณ๐Ÿ‡ต Installation npm install nepali-date-picker Demo and Documentation https://leap

Sep 29, 2022

React Native Week Month Date Picker

React Native Week Month Date Picker

React Native Week Month Date Picker Date picker with a week and month view Installation npm install react-native-week-month-date-picker Dependencies T

Dec 27, 2022

โšก๏ธ Fast parsing, formatting and timezone manipulations for dates

node-cctz CCTZ is a C++ library for translating between absolute and civil times using the rules of a time zone. Install You will need C++11 compatibl

Oct 3, 2022

:clock8: The original jQuery plugin that makes it easy to support automatically updating fuzzy timestamps (e.g. "4 minutes ago").

timeago: a jQuery plugin Timeago is a jQuery plugin that makes it easy to support automatically updating fuzzy timestamps (e.g. "4 minutes ago" or "ab

Dec 25, 2022
Owner
ActuallyNotaDev
ActuallyNotaDev
Create Persian Calendar as html helper with tag builder c# , and convert selected persian date to gregorian date

Persian-Calendar Use JS,Html,CSS,C# White theme for Persian Calendar , easy to use. Create Persian Calendar as html helper. Use Tag builder in c# for

Tareq Awwad 4 Feb 28, 2022
A date picker web component, and spiritual successor to duet date picker

<date-picker> A date picker web component, based on duet date picker, except authored with Lit and using shadow DOM. This is a work in progress. Todo:

Nick Williams 25 Aug 3, 2022
A tiny and fast zero-dependency date-picker built with vanilla Javascript and CSS.

A tiny zero-dependency and framework-agnostic date picker that is incredibly easy to use! Compatible with any web UI framework, vanilla JS projects, and even HTML-only projects!

Nezar 1 Jan 22, 2021
Easy to get a date.

date2data ํ…Œ์ด๋ธ”์— ๋‚ ์งœ๋ณ„ ๋ฐ์ดํ„ฐ ๋„ฃ์„ ๋•Œ๋งˆ๋‹ค ์ƒˆ๋กœ ๊ฐ์ฒด ๋งŒ๋“ค์–ด์„œ ์ž‘์—…ํ•˜๊ธฐ๊ฐ€ ๋งค์šฐ ๊ท€์ฐฎ์•„์„œ ๋งŒ๋“ค์—ˆ๋‹ค. moment.js๋ฅผ ์“ฐ๊ธฐ์—๋Š” ๊ตฌํ˜„ํ•˜๊ณ ์ž ํ•˜๋Š” ๋‚ด์šฉ์ด ๋„ˆ๋ฌด ๊ฐ€๋ฒผ์› ์Œ Install npm i date2data Usage import {getMonthlyDate

Duho Kim 3 Apr 12, 2022
๐Ÿ•‘ js-joda is an immutable date and time library for JavaScript.

js-joda is an immutable date and time library for JavaScript. It provides a simple, domain-driven and clean API based on the ISO8601 calendar.

null 1.5k Dec 27, 2022
CalendarPickerJS - A minimalistic and modern date-picker component/library ๐Ÿ—“๏ธ๐Ÿ‘จ๐Ÿฝโ€๐Ÿ’ป Written in Vanilla JS

CalendarPickerJS The simple and pretty way to let a user select a day! Supports all major browser. Entirely written in Vanilla JavaScript with no depe

Mathias Picker 15 Dec 6, 2022
โฐ Day.js 2KB immutable date-time library alternative to Moment.js with the same modern API

English | ็ฎ€ไฝ“ไธญๆ–‡ | ๆ—ฅๆœฌ่ชž | Portuguรชs Brasileiro | ํ•œ๊ตญ์–ด | Espaรฑol (Espaรฑa) | ะ ัƒััะบะธะน Fast 2kB alternative to Moment.js with the same modern API Day.js is a

null 41.7k Dec 28, 2022
โณ Modern JavaScript date utility library โŒ›๏ธ

date-fns provides the most comprehensive, yet simple and consistent toolset for manipulating JavaScript dates in a browser & Node.js. ?? Documentation

date-fns 30.6k Dec 29, 2022
:clock8: :hourglass: timeago.js is a tiny(2.0 kb) library used to format date with `*** time ago` statement.

timeago.js timeago.js is a nano library(less than 2 kb) used to format datetime with *** time ago statement. eg: '3 hours ago'. i18n supported. Time a

hustcc 4.9k Jan 4, 2023
โฐ Day.js 2kB immutable date-time library alternative to Moment.js with the same modern API

English | ็ฎ€ไฝ“ไธญๆ–‡ | ๆ—ฅๆœฌ่ชž | Portuguรชs Brasileiro | ํ•œ๊ตญ์–ด | Espaรฑol (Espaรฑa) | ะ ัƒััะบะธะน Fast 2kB alternative to Moment.js with the same modern API Day.js is a

null 41.7k Dec 28, 2022