Project Title
Date Conversion
Description
A light weight utility package for simple date conversion in javascript.
Installation
Describe the installation process. Include any prerequisites, such as required libraries or tools.
git clone https://github.com/yourusername/your-repo-name.git
cd your-repo-name
npm install
Documentation
Function Name | Description | Input | Output | Example | Notes |
---|---|---|---|---|---|
dateAndMonth |
Extracts the date and month from a string in ISO format. | String in ISO format (e.g., 2024-02-14 ) |
String with date and month (e.g., 14 Feb ) |
dateAndMonth("2024-02-14") |
Throws error if invalid format. |
minutesToHours |
Converts minutes to hours (integer part only). | Number of minutes | Number of hours | minutesToHours(120) |
|
dateMonthNameYearCommaSeperated |
Formats a string in ISO format to "date, month name year" with comma separation. | String in ISO format (e.g., 2024-02-14 ) |
String with formatted date (e.g., 14, Feb 2024 ) |
dateMonthNameYearCommaSeperated("2024-02-14") |
Throws error if invalid format. |
datediff |
Calculates the difference between a given date and the current date in days (rounded). | String in ISO format (e.g., 2024-02-15 ) |
Number of days difference | datediff("2024-02-15") |
Throws error if invalid format. |
dateAndMonthNameCommaSeperated |
Formats a date string to "date, month name" with comma separation. | String in "YYYY-MM" format (e.g., 2024-02 ) |
String with formatted date (e.g., 02, Feb ) |
dateAndMonthNameCommaSeperated("2024-02") |
|
convertToIST |
Converts a date string in UTC to IST time with hours:minutes and AM/PM format. | String in any date format (e.g., 2024-02-14T12:00:00 ) |
String with IST time (e.g., 12:30 PM ). |
convertToIST("2024-02-14T12:00:00") |
Undefined if invalid format. |
dayDateandMonthName |
Formats a date string to "Day, date month name". | String in any date format (e.g., 2024-02-14 ) |
String with formatted date (e.g., Wed, 14 Feb ) |
dayDateandMonthName("2024-02-14") |
|
dayMonthNameAndDate |
Formats a date string to "Date month name, Day". | String in any date format (e.g., 2024-02-14 ) |
String with formatted date (e.g., 14 Feb, WED ) |
dayMonthNameAndDate("2024-02-14") |