Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jalali-convertor

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jalali-convertor

fastest javascript functions for converting Jalaali (Jalali, Persian, Khayyami, Khorshidi, Shamsi) and Gregorian calendar systems to each other.

  • 1.1.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Jalaali JavaScript

fastest javascript functions for converting Jalaali (Jalali, Persian, Khayyami, Khorshidi, Shamsi) and Gregorian calendar systems to each other.

Usage

const date = require("jalali-convertor")


// get curent date
console.log(date.jDate()); // [ 1402, 3, 4 ]
console.log(date.gDate()); // [ 2023, 5, 25 ]

// get curent timestamp
console.log(date.jTime()); // 1685018686260
console.log(date.gTime()); // 1685018686261
console.log(new Date(date.jTime())); // 2023-05-25T12:44:46.262Z UTC
console.log(new Date(date.gTime())); // 2023-05-25T12:44:46.262Z UTC

// get specific date
console.log(date.jDate(1685014909046)); // [ 1402, 3, 4 ]
console.log(date.gDate(1685014909046)); // [ 2023, 5, 25 ]

// get specific timestamp
console.log(date.jTime(1402, 3, 4)); // 1684960200000
console.log(date.gTime(2023, 5, 25)); // 1684960200000
console.log(new Date(date.jTime(1402, 3, 4))); // 2023-05-24T20:30:00.000Z UTC
console.log(new Date(date.gTime(2023, 5, 25))); // 2023-05-24T20:30:00.000Z UTC

// get specific timestamp at 13:30 in your time zone
console.log(date.jTime(1402, 3, 4, 13, 30)); // 1685008800000
console.log(date.gTime(2023, 5, 25, 13, 30)); // 1685008800000
console.log(new Date(date.jTime(1402, 3, 4, 13, 30))); //2023-05-25T10:00:00.000Z UTC
console.log(new Date(date.gTime(2023, 5, 25, 13, 30))); //2023-05-25T10:00:00.000Z UTC

// convert date
console.log(date.j2g(1402, 3, 4)); // [ 2023, 5, 25 ]
console.log(date.g2j(2023, 5, 25)); // [ 1402, 3, 4 ]

licence

created by seezaara

Keywords

FAQs

Package last updated on 04 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

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