@bondsports/date-time
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

Date and Time Utility Package

This package provides a set of functions for working with date and time in JavaScript using the Day.js library. It includes functions for parsing, formatting, and converting timestamps in various timezones.

Installation

You can install this package using npm or yarn:

npm install @bondsports/date-time

Usage

To use the functions provided by this package, import them as follows:

import {
    parseUtc,
    parseWithTimezone,
    formatDateTime,
    convertUtcTimestampToTimezone,
    convertTimestampFromTimezoneToUtc,
    convertUtcTimestampToLocalTime,
    convertLocalTimestampToUtc,
    convertTimestampFromTimezoneToTimezone,
} from '@bondsports/date-time';

Functions

  • parseUtc(input: DateInput): dayjs.Dayjs: Parses a date in UTC mode.
  • parseWithTimezone(input: DateInput, timezone: string): dayjs.Dayjs: Parses a date in the specified timezone.
  • formatDateTime(input: dayjs.Dayjs, format?: DateTimeFormats, languageRegionCode?: LanguageRegionCodes): string: Formats a date as a string with optional format and language region.
  • convertUtcTimestampToTimezone(input: DateInput, toTimezone: string, format?: DateTimeFormats, languageRegionCode?: LanguageRegionCodes): string: Converts a UTC timestamp to a specified timezone and formats it.
  • convertTimestampFromTimezoneToUtc(input: DateInput, fromTimezone: string, format?: DateTimeFormats, languageRegionCode?: LanguageRegionCodes): string: Converts a timestamp from a specific timezone to UTC and formats it.
  • convertUtcTimestampToLocalTime(input: DateInput, format?: DateTimeFormats, languageRegionCode?: LanguageRegionCodes): string: Converts a UTC timestamp to the local time of the system's timezone and formats it.
  • convertLocalTimestampToUtc(input: DateInput, format?: DateTimeFormats, languageRegionCode?: LanguageRegionCodes): string: Converts a local timestamp to UTC and formats it.
  • convertTimestampFromTimezoneToTimezone(input: DateInput, fromTimezone: string, toTimezone: string, format?: DateTimeFormats, languageRegionCode?: LanguageRegionCodes): string: Converts a timestamp from one timezone to another and formats it.

For detailed documentation of each function and its parameters, refer to the source code and JSDoc comments.

Readme

Keywords

none

Package Sidebar

Install

npm i @bondsports/date-time

Weekly Downloads

26

Version

2.0.1

License

none

Unpacked Size

32.4 kB

Total Files

34

Last publish

Collaborators

  • dan.spinosa--bondsports.co
  • evadshin
  • eyal.borovsky
  • gittyp
  • ido.naveh.bondsports
  • noam.benzeev
  • taroninak
  • barak_matityahu
  • jbknickerbocker