
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
calendar-virtual
Advanced tools
Create a virtual calendar based on a real time frame (1 real week = 1 year in the virtual calendar).
Should be named virtual-calendar but someone already owns that package :(
This package was made to easily manage virtual calendars. This came from the need that in a game i'm building there are events that can run for any length in the real world but would always translate to 1 year in game.
Example:
Event 1:
- length: 1 week
- game length: 1 year
- half of the week would translate to 6 months in game
----------------------------------------
Event 2:
- length: 1 month
- game length: 1 year
- 15 days would translate to 6 months in game
----------------------------------------
Simply add the package to your project:
yarn add calendar-virtual
Or through npm:
npm add calendar-virtual
First you need to create a virtual calendar
import { CalendarVirtual } from 'calendar-virtual'
const now = new Date()
const virtualCalendar = new CalendarVirtual({
realLength: 15
virtualLength: 365
genesisDate: now
})
When creating a new CalendarVirtual you will have to specify the following elements in the configuration:
realLength: This reprensents the number of days the real event will takevirtualLength: This reprensents the number of days the virtual event will takegenesisDate: This reprensents date at which the virtual calendar will be initiatedHere are the various utilities you can use with the virtual calendar.
virtualGenesisDate
This will get the first date of the virtual calendar.
returns Date
virtualEndDate
This will get the end date of the virtual calendar (genesisDate + virtualLength).
returns Date
distanceToEnd(dateFrom?: Date)
Will give a readable string of how far the date given as parameter or the current date (if no param passed) is from the end date.
returns string
Example:
12 months
5 days
daysToEnd(dateFrom?: Date)
Will give the number of days from the date given as parameter or the current date (if no param passed) to the end date.
returns number
isPastEnd(dateFrom?: Date)
Will tell if the date given as parameter or the current date (if no param passed) is past the end of the virtual calendar.
returns boolean
isPastGenesis(dateFrom?: Date)
Will tell if the date given as parameter or the current date (if no param passed) is past the genesis of the virtual calendar.
returns boolean
isBeforeEnd(dateFrom?: Date)
Will tell if the date given as parameter or the current date (if no param passed) is before the end of the virtual calendar.
returns boolean
isBeforeGenesis(dateFrom?: Date)
Will tell if the date given as parameter or the current date (if no param passed) is before the genesis of the virtual calendar.
returns boolean
virtualDate(realDate: Date)
Will translate the given real date to its equivalent in the virtual calendar.
returns Date
realDate(virtualDate: Date)
Will translate the given virtual date to its equivalent in the real calendar.
returns Date
Please follow the templates when creating an issue at:
https://github.com/crimson-med/calendar-virtual/issues
Burlet Mederic
FAQs
Create a virtual calendar based on a real time frame (1 real week = 1 year in the virtual calendar).
We found that calendar-virtual demonstrated a not healthy version release cadence and project activity because the last version was released 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.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.