GithubHelp home page GithubHelp logo

arshadkazmi42 / custom-date-formatting Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 59.0 1.35 MB

:calendar: Npm package for custom date formatting

License: GNU General Public License v3.0

JavaScript 49.60% TypeScript 50.40%
dates formatting moment format-date date-formatting

custom-date-formatting's Introduction

Custom Date Formatting

Build Badge npm Downloads Package Size NPM Version Contributors Commit

How to install?

NPM

Usage

Custom Format date with Days (+/-)

Pass the format of the date required and numberOfDays to add from current day to the Function.
For previous days numberOfDays should be passed as negative value.

// Create Instance of the DateValidator
const DateFormatting = require('custom-date-formatting');

// This will return a string with new date
DateFormatting.getNextOrPrevDateCustomFormat("YYYY-MM-DD", 0);

// Output: "2018-10-06"

Custom Format date with Minutes (+/-)

Pass the format of date required and minutesToAdd to add/subtract minutes from current time to the Function.
For passed minute of time, minutesToAdd should be passed as negative value.

// Create Instance of the DateValidator
const DateFormatting = require('custom-date-formatting');

// This will return a string with new date and time
DateFormatting.getNextOrPrevMinuteDateCustomFormat("YYYY-MM-DD HH:mm", 1);

// Output: "2018-10-06 00:39"

Custom Format date with Seconds (+/-)

Pass the format of date required and secondsToAdd to add/subtract seconds from current time.
For passed minute of time, secondsToAdd should be passed as negative value.

// Create Instance of the DateValidator
const DateFormatting = require('custom-date-formatting');
// This will return a string with new date and time
DateFormatting.getNextOrPrevSecondDateCustomFormat("YYYY-MM-DD HH:mm:ss", 10);

// Output: "2018-10-06 00:40:02"

Custom Source Format date custom new format

Pass the date (input date), currentFormat (input date format), newformat. (required date format)to the Function.

// Create Instance of the DateValidator
const DateFormatting = require('custom-date-formatting');

// This will return a string with date in new format
DateFormatting.customSourceDateFormatToCustomNewDateFormat("2017-08-28 23:22:00", "YYYY-MM-DD HH:mm:ss", "dddd DD MMM YYYY");

// Output: "Monday 28 Aug 2017"

Timestamp from custom date format

Pass the date (input date), currentFormat (input date format)to the function.

// Create Instance of the DateValidator
const DateFormatting = require('customdateformatting');

// This will return input date value as timestamp in milliseconds.
DateFormatting.getTimeStampFromCurrentDateFormat("28 Aug 2017", "DD MMM YYYY");

// Output: 1503858600000

Contributors

Thank you to all the contributors who have helped us in making this project better ๐Ÿ™Œ

Contributing Guidelines

Read the contributing guidelines here

custom-date-formatting's People

Contributors

adrianteri avatar alexdresko avatar alvintan05 avatar apoorva-13 avatar ardenasasvc avatar arjunrajpal avatar arshadkazmi42 avatar ayushkothari27 avatar ccarmivalarao avatar chong601 avatar dependabot[bot] avatar hyp3rflux avatar krzysztofwojdat avatar mahalb-se avatar mayankdhiman avatar momomen avatar msarfrazanwar avatar nine-tails9 avatar rogers9798 avatar roshanadh avatar ryanmdoyle avatar sauravjaiswalsj avatar shubhankarb180 avatar sinumohan avatar srdevelopervishal avatar srsandy avatar theflash10 avatar tusharkavya avatar u-ways avatar wly5 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

custom-date-formatting's Issues

Add yourself to Contributors.md

Add your self to Contributors.md .

Do not add yourself at the top. or bottom of the list. Add yourself to in between the list, doing this there will less chances of getting conflicts.

Also do tag the issue number in the PR description

Change heading size of in readme

Change heading size of this title in readme

Small package which provides some basic functions for custom date formatting

If readme is opened in edit mode, you will find the title like this

# Small package which provides some basic functions for custom date formatting

this needs to change to

## Small package which provides some basic functions for custom date formatting

Add code block to title

Add code block to this title in README.md

Make the below change.

Custom Format date with Minutes (+/-) => Custom Format date with Minutes (+/-)

Change import statement in readme

Change the import statements in usage examples in the README file

from

const DateFormatting = require('custom-date-formatting');

to

const DateFormatting = require('customdateformatting');

Create Contributors.md file

Create a Contributors.md file in root directory which will contain list of contributors in this syntax

# Contributors

- [Arshad Kazmi](https://github.com/arshadkazmi42)

Also do add yourself to the list

Comment formatting

Add space after // in the comments, in the usage sample which is present in readme

//This will return a string with new date
change to
// This will return a string with new date

Change this for all the usage samples

fix vulnerability

  • Delete package-lock.json
  • Run npm install
  • Commit package-lock.json
  • Create pull request

Add Contributors Avatar to README.md

We would want to show contributors avatar in our README.md file.

This piece of code needs to be added in the README.md file bottom, with the title something like this

https://github.com/arshadkazmi42/ak-logger#contributors

[![](https://sourcerer.io/fame/arshadkazmi42/arshadkazmi42/custom-date-formatting/images/0)](https://sourcerer.io/fame/arshadkazmi42/arshadkazmi42/custom-date-formatting/links/0)[![](https://sourcerer.io/fame/arshadkazmi42/arshadkazmi42/custom-date-formatting/images/1)](https://sourcerer.io/fame/arshadkazmi42/arshadkazmi42/custom-date-formatting/links/1)[![](https://sourcerer.io/fame/arshadkazmi42/arshadkazmi42/custom-date-formatting/images/2)](https://sourcerer.io/fame/arshadkazmi42/arshadkazmi42/custom-date-formatting/links/2)[![](https://sourcerer.io/fame/arshadkazmi42/arshadkazmi42/custom-date-formatting/images/3)](https://sourcerer.io/fame/arshadkazmi42/arshadkazmi42/custom-date-formatting/links/3)[![](https://sourcerer.io/fame/arshadkazmi42/arshadkazmi42/custom-date-formatting/images/4)](https://sourcerer.io/fame/arshadkazmi42/arshadkazmi42/custom-date-formatting/links/4)[![](https://sourcerer.io/fame/arshadkazmi42/arshadkazmi42/custom-date-formatting/images/5)](https://sourcerer.io/fame/arshadkazmi42/arshadkazmi42/custom-date-formatting/links/5)[![](https://sourcerer.io/fame/arshadkazmi42/arshadkazmi42/custom-date-formatting/images/6)](https://sourcerer.io/fame/arshadkazmi42/arshadkazmi42/custom-date-formatting/links/6)[![](https://sourcerer.io/fame/arshadkazmi42/arshadkazmi42/custom-date-formatting/images/7)](https://sourcerer.io/fame/arshadkazmi42/arshadkazmi42/custom-date-formatting/links/7)

Add Codacy Badge in README

Describe the bug
Add code quality badge to readme

Additional context
Add Code Quality badge next to downloads badge in README file

just copy the below code and add it in readme below downloads code

[![Codacy Badge](https://api.codacy.com/project/badge/Grade/a47235834dff4a88ae37bdc7460a5c7d)](https://www.codacy.com/app/arshadkazmi42/custom-date-formatting?utm_source=github.com&utm_medium=referral&utm_content=arshadkazmi42/custom-date-formatting&utm_campaign=Badge_Grade)

To work on this

  1. Put a comment here who ever is working on it.
  2. Also tag this issue in your Pull Request description.

Note: Anyone who is not following above two steps, their PR will be rejected

Fix Contributors Link

All the contributors name added here are in wrong format
https://github.com/arshadkazmi42/custom-date-formatting/blob/master/Contributors.md

it needs to be something like this
[Arshad Kazmi](https://github.com/arshadkazmi42)

So for this, [] these brackets needs to be added in all names.

Steps to work on this

  1. Comment Here that you are working on it.
  2. Create PR. (No need to wait for anyone's reply)
  3. Add this in your PR description Closes #62 (This is not your commit message)

Important Note

First person to comment here, gets the issue.
Is someone is working on it, please do no create duplicate request.
Check with the person who has commented first whether they are continuing with it or not.
If they are not continuing, then you can add comment here and create a new PR.

Note: Work on a feature branch, do not work on master branch.

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.