import { Moment, unitOfTime } from 'moment-timezone'; import { Time, TimeLike } from '../time'; type _moment = typeof import('moment') | typeof import('moment-timezone'); /** * Set a reference for `moment` to be used by some of the date helpers, so that this library doesn't need to ship its own `moment.js` bundle (for bundle size reasons). * * This needs to be done before using any of the `moment.js` related date helpers. A good place to do this is in an app initialization script (e. g. for Stencil apps, that would be the `globalScript`). */ export declare const setMomentReference: (momentRef: _moment) => void; /** * Merges the time of a date into another date. * * @param date The date to merge the time into * @param time The time to merge into the date */ export declare const mergeDateAndTime: (date: Moment | string, time: Time) => Moment; /** * Convert minutes to milliseconds. */ export declare const minsToMs: (mins: number) => number; /** * Convert milliseconds to decimal hours. */ export declare const msToDecimalHours: (ms: number) => number; /** * Get the amount of worked hours as a decimal. */ export declare const getWorkedHours: (start: Moment, end: Moment, breakMinutes: number) => number; /** * Get a function to pass to `Array#sort` to sort an array of objects by date. * * @param key the key name of the date to sort by */ export declare const sortByDate: (key: K) => (a: T, b: T) => number; /** * Format a date as a timestamp depending on how long ago it was. */ export declare const formatAsTimestamp: (date: Moment) => string; /** * Format a date as day and month without the year, respecting the current locale (hopefully this works). * * @todo needs a test */ export declare const formatAsDayAndMonth: (date: Moment, format?: "l" | "L" | "ll" | "LL") => string; /** * Get the next working day, i. e. the next day that's not on a weekend (Sat/Sun). */ export declare const getNextWorkingDay: () => Moment; /** * Get the difference between an start an end time. */ export declare const getDuration: (start: TimeLike, end: TimeLike) => Time; /** * Validate a shift's duration. Returns `true` if the shift is valid and `false` otherwise. */ export declare const validateShiftDuration: (start: TimeLike, end: TimeLike, minDurationInMinutes: number | undefined) => boolean; /** * Get the dates of the next `n` weeks from the start date. Don't try to use this with a start date that's not a Monday or you will break the internets. */ export declare const getDatesOfNextWeeks: (startOfCurrentWeek: Moment, { n, includeWeekends }?: { n?: number | undefined; includeWeekends?: boolean | undefined; }) => Moment[]; /** * Get the start and end dates of a calendar month, which is the start date of the week that includes the first day of the month, and the end date of the week that includes the last day of the month. */ export declare const getCalendarMonthBoundaries: (month: Moment, weekStartsOnSunday?: boolean) => { start: Moment; end: Moment; }; /** * Check whether the given moment is in the future. */ export declare const isInFuture: (date: Moment | string, granularity?: unitOfTime.StartOf) => boolean; /** * Check whether the given moment is in the past. */ export declare const isInPast: (date: Moment | string, granularity?: unitOfTime.StartOf) => boolean; export {};