nhb-toolbox 4.28.50 → 4.28.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@
4
4
 
5
5
  All notable changes to the package will be documented here.
6
6
 
7
+ ## [4.28.51] - 2025-12-24
8
+
9
+ - **Removed** strictness from *format* parameter of `formatTimePart` utility and `Chronos.formatTimePart` static method.
10
+
7
11
  ## [4.28.50] - 2025-12-24
8
12
 
9
13
  ### ✨ New Class, Chronos Plugin, and Utilities
@@ -1,7 +1,7 @@
1
1
  import type { Enumerate, NumberRange } from '../number/types';
2
2
  import type { LooseLiteral, TupleOf } from '../utils/types';
3
3
  import { INTERNALS } from './constants';
4
- import type { $NativeTzNameOrId, $TimeZoneIdentifier, $UTCOffset, ChronosInput, ChronosInternals, ChronosMethods, ChronosObject, ChronosPlugin, ChronosWithOptions, DateRangeOptions, DateTimeFormatOptions, FormatOptions, LocalesArguments, Milliseconds, MonthName, Quarter, RangeWithDates, RelativeDateRange, RelativeRangeOptions, StrictFormat, TimeFormatToken, TimeUnit, TimeUnitValue, TimeZone, TimeZoneId, TimeZoneIdNative, TimeZoneName, UTCOffset, WeekDay } from './types';
4
+ import type { $NativeTzNameOrId, $TimeZoneIdentifier, $UTCOffset, ChronosInput, ChronosInternals, ChronosMethods, ChronosObject, ChronosPlugin, ChronosWithOptions, DateRangeOptions, DateTimeFormatOptions, FormatOptions, LocalesArguments, Milliseconds, MonthName, Quarter, RangeWithDates, RelativeDateRange, RelativeRangeOptions, StrictFormat, TimeOnlyFormat, TimeUnit, TimeUnitValue, TimeZone, TimeZoneId, TimeZoneIdNative, TimeZoneName, UTCOffset, WeekDay } from './types';
5
5
  /**
6
6
  * * Creates a new immutable `Chronos` instance.
7
7
  *
@@ -711,11 +711,11 @@ export declare class Chronos {
711
711
  *
712
712
  * - *Input will default to today's date and assume local timezone if no offset is provided.*
713
713
  *
714
- * @param format - Format tokens accepted by {@link formatStrict()} method ({@link TimeFormatToken}) for time part only.
714
+ * @param format - Format tokens accepted by {@link formatStrict()} method ({@link TimeOnlyFormat}) for time part only.
715
715
  * Default: `hh:mm:ss a` → 02:33:36 pm.
716
716
  * @returns Formatted time string in local (System) time.
717
717
  */
718
- static formatTimePart(time: string, format?: TimeFormatToken): string;
718
+ static formatTimePart(time: string, format?: TimeOnlyFormat): string;
719
719
  /**
720
720
  * @static Returns ISO date strings for each occurrence of a weekday from today, spanning a relative time range.
721
721
  *
@@ -99,6 +99,8 @@ export type DateFormatToken = `${DateToken} ${Exclude<MonthToken, 'M' | 'MM'>}`
99
99
  export type TimeFormatToken = `${Exclude<HourToken, 'h' | 'hh' | 'H'>}:${Exclude<MinuteToken, 'm'>}` | `${Exclude<HourToken, 'H' | 'HH' | 'h'>}:${Exclude<MinuteToken, 'm'>} ${TimeToken}` | `${Exclude<HourToken, 'h' | 'hh' | 'H'>}:${Exclude<MinuteToken, 'm'>}:${Exclude<SecondToken, 's'>}` | `${Exclude<HourToken, 'H' | 'HH' | 'h'>}:${Exclude<MinuteToken, 'm'>}:${Exclude<SecondToken, 's'>} ${TimeToken}` | `${Exclude<HourToken, 'h' | 'hh' | 'H'>}:${Exclude<MinuteToken, 'm'>}:${Exclude<SecondToken, 's'>}:${Exclude<MSToken, 'ms'>}` | `${Exclude<HourToken, 'H' | 'HH' | 'h'>}:${Exclude<MinuteToken, 'm'>}:${Exclude<SecondToken, 's'>}:${Exclude<MSToken, 'ms'>} ${TimeToken}`;
100
100
  type DateTimeISO = 'YYYY-MM-DDTHH:mm:ss.mssZZ';
101
101
  type TokenConnector = ' ' | ', ' | '; ' | ' - ';
102
+ /** Format tokens for time only string */
103
+ export type TimeOnlyFormat = LooseLiteral<TimeFormatToken>;
102
104
  /** Pre-defined literal types for formatting date and time. Optionally can pass any string. */
103
105
  export type StrictFormat = LooseLiteral<DateTimeISO | DateFormatToken | TimeFormatToken | `${DateFormatToken}${TokenConnector}${TimeFormatToken}`>;
104
106
  /** `BCP47` locale string or {@link Intl.Locale} object that contain one or more language or locale tags */
@@ -1,5 +1,5 @@
1
1
  import type { Numeric } from '../types/index';
2
- import type { $TimeZoneIdentifier, ClockTime, DateFormatOptions, HourMinutes, TimeFormatToken, TimeZoneDetails, TimeZoneIdNative, UTCOffset } from './types';
2
+ import type { $TimeZoneIdentifier, ClockTime, DateFormatOptions, HourMinutes, TimeOnlyFormat, TimeZoneDetails, TimeZoneIdNative, UTCOffset } from './types';
3
3
  /**
4
4
  * * Extracts the hour and minute from a time string in `HH:MM` or `-HH:MM` format.
5
5
  *
@@ -109,8 +109,8 @@ export declare function formatDate(options?: DateFormatOptions): string;
109
109
  *
110
110
  * - *Input will default to today's date and assume local timezone if no offset is provided.*
111
111
  *
112
- * @param format - Format tokens accepted by {@link formatDate} method ({@link TimeFormatToken}) for time part only.
112
+ * @param format - Format tokens accepted by {@link formatDate} method ({@link TimeOnlyFormat}) for time part only.
113
113
  * Default: `hh:mm:ss a` → 02:33:36 pm.
114
114
  * @returns Formatted time string in local (System) time.
115
115
  */
116
- export declare function formatTimePart(time: string, format?: TimeFormatToken): string;
116
+ export declare function formatTimePart(time: string, format?: TimeOnlyFormat): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nhb-toolbox",
3
- "version": "4.28.50",
3
+ "version": "4.28.51",
4
4
  "description": "A versatile collection of smart, efficient, and reusable utility functions, classes and types for everyday development needs.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",