npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@jmjhox/date-simplify

v3.0.2

Published

<div id="top"></div>

Downloads

14

Readme

Issues MIT License Npm package version Npm package monthly downloads Npm package dependents

About The Project

There are many great libraries to calculate time & dates and often they offer you a set of tools that lets you build your code, but sometimes your are struggling to find that specific function that do what you wants to do in your code while you trying to write the less code possible or not to spend too much time on it. Keep it simple!

That´s WHY you should start using Date-Simplify instead! or at least give it a try

Built With

Getting Started

Prerequisites

  • npm
    npm install @jmjhox/date-simplify
  • Javascript/Typescript project to integrate our library

Installation

We only have to import "DateSimplify" into our proyect like a dependency:

import { dateSimplify } from '@jmjhox/date-simplify'

Below it is a example of how you import it to your component.ts using Angular 13:

import { Component, OnInit } from '@angular/core';
import { dateSimplify } from '@jmjhox/date-simplify'
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit{
  constructor(){}
  ngOnInit(): void
  {
     dateSimplify.dateFormat('12/12/1998')
  }
}

Usage

getAgeLimitOnUTC

Is a method used to get the age limit of the user based on the actual date of the year or a custom date you want to use it from reference using UTC

How to use it

It has two parameters:

getAgeLimitOnUTC(dateRange: number, ChangeDate?: string)

dateRange: number(the number you want to limit)
ChangeDate?: string (the date you migh want to use from reference, the format is dd/mm/yyyy)

getAgeLimitOnLocal

Is a method used to get the age limit of the user based on the actual date of the year or a custom date you want to use it from reference using your local time

How to use it

It has two parameters:

getAgeLimitOnLocal(dateRange: number, ChangeDate?: string)

dateRange: number(the number you want to limit)
ChangeDate?: string (the date you migh want to use from reference, the format is dd/mm/yyyy)

dateFormat

Is a method that formats any kind of date to the want desired for the user, if for some reasons, the date is impossible to get, it returns the same date introduced.

Structure

dateFormat(
  dateRequest: string, 
  formatStyle: string)

dateRequest is the date introduced on string format. it is a experimental feature, for now this kind of format is permitted to be used: 02-23-1998 02/23/1998 02231998

formatStyle is the type of date you want to be returned or formatted, this is a list of formats you migh want to use: ddMMyyyy dd-MM-yyyy dd/MM/yyyy ISO UNIX

Take in consideration that some formats as ddMMyyyy, dd-MM-yyyy and ISO returns a string on response using this function, meanwhile UNIX format returns a number on response. Formats like dd.MM.yyyy , MM.dd.yyyy and other kind, we are working to this combinations be implemented on our next release, for now it is not being supported.

How to use it

ddMMyyyy

dateSimplify.dateFormat('02-23-1998', 'ddMMyyyy')

It should Return 02231998 on string format.

dd-MM-yyyy

dateSimplify.dateFormat('02-23-1998', 'dd-MM-yyyy')

It should Return 02-23-1998 on string format.

ISO

dateSimplify.dateFormat('02-23-1998', 'ISO')

It should Return 1998-02-23T05:00:00.000Z on string format.

UNIX

dateSimplify.dateFormat('02-23-1998', 'UNIX')

It should Return 888192000000 on number format.

unixFormat

Is a method that formats any kind of date to the want desired for the user, using UNIX format to be handled.

Structure

unixFormat(
  dateRequest: number, 
  formatStyle: string)

dateRequest is the date introduced on string format. it is a experimental feature, for now this kind of format is permitted to be used: 1648313180

formatStyle is the type of date you want to be returned or formatted, this is a list of formats you migh want to use: ddMMyyyy dd-MM-yyyy dd/MM/yyyy

dateIsValid

method to check if a date is valid or not. it only returns false or true.

How to use it

dateSimplify.dateIsValid('12','12','1998')

It should Return 12/12/1998 on string format

dateIsValidFix

Checks if the date is valid, and attempts to fix the date automatically for yourself

Format:
dateSimplify.dateIsValidFix(day: string, month: string, year: string)

How to use it

dateSimplify.dateIsValidFix('12','12','1998')

It should Return 12/12/1998 on string format

For more examples, please refer to the Documentation

Roadmap

  • [x] Add Changelog
  • [x] Add back to top links
  • [ ] Add Additional Templates w/ Examples
  • [ ] Add "components" document to easily copy & paste sections of the readme
  • [ ] Multi-language Support
    • [ ] Chinese
    • [ ] Spanish

See the open issues for a full list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Date-Simplify is distributed under the MIT License.

Contact

JMJHOX - [email protected]

Project Link: https://github.com/JMJHOX/date-simplify

Code of Conduct

In order to ensure that the Date-simplify community is welcoming to all, please review and abide by the Code of Conduct.

Security Vulnerabilities

If you discover a security vulnerability within Date-simplify, please send an e-mail to Jose Aparicio via [email protected]. All security vulnerabilities will be promptly addressed.