@heartinz/date_and_time_processor
v2.5.1
Published
| format | Display Example | Code | |--------|-----------------|------| | timeISO: | 2024-12-07T00:00:00.000+05:30 | ISO | | mmddyyyy: | 12-07-2024 | MM-dd-yyyy | | ddmmyyyy: |07-12-2024 | dd-MM-yyyy | | yyyymmdd: | 2024-12-07 | yyyy-MM-dd | | yyyyddmm: |
Readme
Sample
| format | Display Example | Code | |--------|-----------------|------| | timeISO: | 2024-12-07T00:00:00.000+05:30 | ISO | | mmddyyyy: | 12-07-2024 | MM-dd-yyyy | | ddmmyyyy: |07-12-2024 | dd-MM-yyyy | | yyyymmdd: | 2024-12-07 | yyyy-MM-dd | | yyyyddmm: | 2024-07-12 | yyyy-dd-MM | | shortMonthFormat: | 07 Dec 2024 | dd LLL yyyy | | fullMonthWeekday: | 07 December 2024, Saturday | dd MMMM yyyy, cccc | | dateSlash: | 07/12/2024 | dateSlash | | unixEpoch: | 1708435200 | unixEpoch |
📅 Available Range Types
The following table lists all the available range types with their descriptions:
| Range Type | Description | Example Output (Start Date - End Date) |
|----------------|------------------------------------------------------------|---------------------------------------------------------|
| last7Days | Last 7 days from the given/current date. | 2025-03-10T00:00:00.000Z - 2025-03-17T23:59:59.999Z |
| thisWeek | Current week from Monday to Sunday. | 2025-03-17T00:00:00.000Z - 2025-03-23T23:59:59.999Z |
| lastWeek | Previous week from Monday to Sunday. | 2025-03-10T00:00:00.000Z - 2025-03-16T23:59:59.999Z |
| thisMonth | Current month from the 1st to the last day. | 2025-03-01T00:00:00.000Z - 2025-03-31T23:59:59.999Z |
| lastMonth | Previous month from the 1st to the last day. | 2025-02-01T00:00:00.000Z - 2025-02-28T23:59:59.999Z |
| thisYear | Current year from January 1st to December 31st. | 2025-01-01T00:00:00.000Z - 2025-12-31T23:59:59.999Z |
| lastYear | Previous year from January 1st to December 31st. | 2024-01-01T00:00:00.000Z - 2024-12-31T23:59:59.999Z |
| last6Months | Last 6 months from the current date. | 2024-09-01T00:00:00.000Z - 2025-03-17T23:59:59.999Z |
| customDays | Custom number of past days (e.g., last 30 days). | 2025-02-16T00:00:00.000Z - 2025-03-17T23:59:59.999Z |
modifyISOTime
const originalTime = '2024-12-01T00:00:00.000+05:30';
// Example: Add 2 days, subtract 1 month, add 3 hours const modified = modifyISOTime(originalTime, { days: 2, months: -1, hours: 3, minutes: -15 });
