Giter Club home page Giter Club logo

ifc-date's Introduction

International Fixed Calendar

IFC is an npm package for simple handling of date and time (based on gregorian calendar) conversion to international fixed calendar date and time within your project.

Installation

Use the package manager npm to install ifc-date.

npm install ifc-date

Usage

const { ifcDate } = require('ifc-date');
//import { ifcDate } from 'ifc-date';

// Current utc time -> 2023-02-19T03:01:55.293Z
console.log( new ifcDate().toISOString() );

// Utc time of timestamp -> 2023-02-19T03:01:55.293Z
console.log( new ifcDate(1676516515293).toISOString() );

// Utc time of gregorian calendar string -> 2023-02-19T03:01:55.000Z
console.log( new ifcDate('February 16, 2023 03:01:55').toISOString() );

// Utc time of gregorian calendar input -> 2023-02-19T03:01:55.293Z
console.log( new ifcDate(2023, 1, 16, 3, 1, 55, 293).toISOString() );

// Utc time of Date or ifcDate object -> 2023-02-19T03:01:55.293Z
console.log( new ifcDate( new Date(2023, 1, 16, 3, 1, 55, 293) ).toISOString() );


// Leap- and Year Day support -> 2024-06-29T03:02:04.004Z
console.log( new ifcDate(2024, 5, 17, 3, 2, 4, 4).toISOString() );
// Leap- and Year Day support -> 2024-LD 03:02:04.004
console.log( new ifcDate(2024, 5, 17, 3, 2, 4, 4).toUTCString() );

// Add/Subtract Time -> returns timestamp example: 1676685715293
const ms = require('ms'); // It's on you how you convert your time to milliseconds
console.log( new ifcDate(2023, 1, 16, 3, 1, 55, 293).addTime( ms('2d') ) );

Information

  • Except for a timestamp or IFC-/Date object, all inputs must be based on gregorian calendar.
  • .toISOString() returns an Date().toISOString(). styled string.
  • .getMonth() and .getUTCMonth() returns the month index (0-12).
  • .getDate() and .getUTCDate() returns 1-28 (29 if leap/year day).
  • .getDay() and .getUTCDay() returns the day index (0-6, 7* Year Day, 8* Leap Day).
  • LD (Leap Day) and YD (Year Day) are special weekend days in the year.

CLI

Looking for an CLI? Check out the cli this package is based on!

ifc-date's People

Contributors

neclaex avatar

Stargazers

Muhammad Miftah avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.