@flightlesslabs/dodo-ui 0.17.0-beta → 0.17.0-beta-2
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/dist/stories/components/Info/Calendar/utils/createDateOfMonth/createDateOfMonth.js +1 -0
- package/dist/stories/developer tools/helpers/Time/getMoment/getMoment.d.ts +3 -1
- package/dist/stories/developer tools/helpers/Time/getMoment/getMoment.js +1 -1
- package/package.json +1 -1
- package/src/lib/stories/components/Info/Calendar/utils/createDateOfMonth/createDateOfMonth.ts +7 -5
- package/src/lib/stories/developer tools/helpers/Time/getMoment/getMoment.ts +3 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ConfigType, OptionType } from 'dayjs';
|
|
2
|
-
import
|
|
2
|
+
import dayjs from 'dayjs';
|
|
3
|
+
type Dayjs = ReturnType<typeof dayjs>;
|
|
3
4
|
/**
|
|
4
5
|
* Acceptable input types for the `getMoment` function, compatible with dayjs.
|
|
5
6
|
*/
|
|
@@ -35,3 +36,4 @@ export interface GetMomentSettings {
|
|
|
35
36
|
* getMoment('01-01-2025', 'DD-MM-YYYY', { timezone: 'Asia/Kolkata' }).format()
|
|
36
37
|
*/
|
|
37
38
|
export default function getMoment(date?: GetMomentDate, format?: GetMomentFormat, settings?: GetMomentSettings): Dayjs;
|
|
39
|
+
export {};
|
package/package.json
CHANGED
package/src/lib/stories/components/Info/Calendar/utils/createDateOfMonth/createDateOfMonth.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import getMoment from '$lib/stories/developer tools/helpers/Time/getMoment/getMoment.js';
|
|
2
|
-
import type dayjs from 'dayjs';
|
|
3
2
|
import type { DateOfMonth } from '../types.js';
|
|
4
3
|
import type { CalendarWeekNames } from '$lib/index.js';
|
|
4
|
+
import dayjsLib from 'dayjs'; // Only needed for types
|
|
5
|
+
|
|
6
|
+
type Dayjs = ReturnType<typeof dayjsLib>;
|
|
5
7
|
|
|
6
8
|
/** Settings for generating calendar dates */
|
|
7
9
|
export interface CreateDatesOfMonthSettings {
|
|
@@ -35,7 +37,7 @@ function dateMoment(
|
|
|
35
37
|
/**
|
|
36
38
|
* Determines if the given day matches "today" (manual or actual).
|
|
37
39
|
*/
|
|
38
|
-
function getIsToday(dayMoment:
|
|
40
|
+
function getIsToday(dayMoment: Dayjs, todayDate: string, todayManual?: string): boolean {
|
|
39
41
|
const dayDateFormat = dayMoment.format('DD-MM-YYYY');
|
|
40
42
|
return todayManual === dayDateFormat || todayDate === dayDateFormat;
|
|
41
43
|
}
|
|
@@ -44,9 +46,9 @@ function getIsToday(dayMoment: dayjs.Dayjs, todayDate: string, todayManual?: str
|
|
|
44
46
|
* Determines if a date should be disabled based on limits and included/excluded lists.
|
|
45
47
|
*/
|
|
46
48
|
function getIsDateDisabled(
|
|
47
|
-
dayMoment:
|
|
48
|
-
minDate?:
|
|
49
|
-
maxDate?:
|
|
49
|
+
dayMoment: Dayjs,
|
|
50
|
+
minDate?: Dayjs,
|
|
51
|
+
maxDate?: Dayjs,
|
|
50
52
|
excludeDates?: string[],
|
|
51
53
|
includeDates?: string[],
|
|
52
54
|
): boolean {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { ConfigType, OptionType } from 'dayjs';
|
|
2
|
-
import dayjs
|
|
2
|
+
import dayjs from 'dayjs';
|
|
3
3
|
import utc from 'dayjs/plugin/utc.js';
|
|
4
4
|
import timezone from 'dayjs/plugin/timezone.js';
|
|
5
5
|
import customParseFormat from 'dayjs/plugin/customParseFormat.js';
|
|
6
6
|
|
|
7
|
+
type Dayjs = ReturnType<typeof dayjs>;
|
|
8
|
+
|
|
7
9
|
dayjs.extend(utc);
|
|
8
10
|
dayjs.extend(timezone);
|
|
9
11
|
dayjs.extend(customParseFormat);
|