New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

datetime-helpers

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

datetime-helpers

Utility functions for working with dates and time

latest
npmnpm
Version
0.8.0
Version published
Weekly downloads
3
-70%
Maintainers
1
Weekly downloads
 
Created
Source

datetime-helpers

datetime-helpers provides functions to work with dates and time.

Day of week helpers

getLocalizedDayOfWeek

import { getLocalizedDayOfWeek } from 'datetime-helpers';

getLocalizedDayOfWeek('en', DayOfWeek.Wednesday)
// returns the localized day of week name for English language

/*
{
  isoNumber: 3,
  name: {
    narrow: 'W',
    short: 'Wed',
    long: 'Wednesday'
  }
}
*/

getLocalizedDaysOfWeek

import { DayOfWeek, getLocalizedDaysOfWeek } from 'datetime-helpers';

getLocalizedDaysOfWeek('en-UK')
// returns a list of the 7 days of week, starting from Monday

getLocalizedDaysOfWeek('en-UK', DayOfWeek.Sunday)
// returns a list of the 7 days of week, starting from Sunday

Month helpers

getMonthGrid

import { DayOfWeek, getMonthGrid } from 'datetime-helpers';

getMonthGrid(Temporal.PlainYearMonth.from({ year: 2022, month: 10 }))
// returns the month grid for October 2022, with weeks starting on Monday
// the grid is a 2-dimensional array (6 weeks x 7 days of week)

getMonthGrid(Temporal.PlainYearMonth.from({ year: 2022, month: 10 }), DayOfWeek.Sunday)
// returns the month grid for October 2022, with weeks starting on Sunday

Install

You can get datetime-helpers via npm.

npm install datetime-helpers

FAQs

Package last updated on 15 Jun 2023

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