From 576dc770431d437e41cd3cbff22008d70d492d09 Mon Sep 17 00:00:00 2001 From: Dan Gowans Date: Mon, 11 Dec 2023 11:21:22 -0500 Subject: [PATCH] badges, formatting, short example --- README.md | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1e6740a..76585cd 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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' ```