Skip to content

Commit

Permalink
badges, formatting, short example
Browse files Browse the repository at this point in the history
  • Loading branch information
dangowans committed Dec 11, 2023
1 parent a1ef8c6 commit 576dc77
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Modern Julian Date

[![npm (scoped)](https://img.shields.io/npm/v/@cityssm/modern-julian-date)](https://www.npmjs.com/package/@cityssm/modern-julian-date)
[![DeepSource](https://app.deepsource.com/gh/cityssm/modern-julian-date.svg/?label=active+issues&show_trend=true&token=gVQq0XqtU1PZ2BWi_k-y1so9)](https://app.deepsource.com/gh/cityssm/modern-julian-date/)
[![Code Climate maintainability](https://img.shields.io/codeclimate/maintainability/cityssm/modern-julian-date)](https://codeclimate.com/github/cityssm/modern-julian-date)
[![codecov](https://codecov.io/gh/cityssm/modern-julian-date/graph/badge.svg?token=O2640MNNY0)](https://codecov.io/gh/cityssm/modern-julian-date)

Converts a regular JavaScript date to the modern Julian date format YYYYDDD,
commonly seen in banking applications.
Expand All @@ -15,14 +17,28 @@ npm install @cityssm/modern-julian-date
## Usage

```javascript
import { toModernJulianDate } from "@cityssm/modern-julian-date";
import {
toModernJulianDate,
toShortModernJulianDate
} from "@cityssm/modern-julian-date";

/*
* toModernJulianDate() returns date strings in YYYYDDD format.
*/

console.log( toModernJulianDate(new Date(2022, 1 - 1, 1)) );
// => 2022001
// => '2022001'

console.log( toModernJulianDate(new Date(2022, 12 - 1, 31)) );
// => 2022365
// => '2022365'

console.log( toModernJulianDate(new Date(2020, 12 - 1, 31)) );
// => 2020366
// => '2020366'

/*
* toShortModernJulianDate() returns date strings in YYDDD format.
*/

console.log( toShortModernJulianDate(new Date(2022, 1 - 1, 1)) );
// => '22001'
```

0 comments on commit 576dc77

Please sign in to comment.