update(moment-business-time): version 1.1 (#49773)

- `nextTransitionTime` added
- `lastTransitionTime` added
- version bump
- tests amended
- maintainer added

https://github.com/lennym/moment-business-time/compare/v0.7.1...v1.1.0

Thanks!
This commit is contained in:
Piotr Błażejewicz (Peter Blazejewicz)
2020-12-18 20:50:22 +01:00
committed by GitHub
parent 2390d3d802
commit ab539dc723
3 changed files with 26 additions and 4 deletions

View File

@@ -1,17 +1,28 @@
// Type definitions for moment-business-time 0.7
// Type definitions for moment-business-time 1.1
// Project: https://github.com/lennym/moment-business-time
// Definitions by: Tomasz Nguyen <https://github.com/swist>
// Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/*~ On this line, import the module which this module adds to */
import * as moment from 'moment';
/*~ Here, declare the same module as the one you imported above */
declare module 'moment' {
interface Moment {
nextWorkingDay: () => Moment;
nextWorkingTime: () => Moment;
/**
* Returns a new object with moment and transition properties representing
* the next moment when the business will transition between 'open' and 'closed' states.
*/
nextTransitionTime: () => TransitionTime;
/**
* Returns a new object with moment and transition properties representing
* the most recent moment when the business transitioned between 'open' and 'closed' states.
*/
lastTransitionTime: () => TransitionTime;
lastWorkingDay: () => Moment;
lastWorkingTime: () => Moment;
@@ -38,4 +49,9 @@ declare module 'moment' {
workinghours?: WorkingHoursMap;
holidays?: string[];
}
interface TransitionTime {
moment: Moment;
transition: 'open' | 'close';
}
}

View File

@@ -54,3 +54,9 @@ moment('2015-12-25T16:30:00Z').isWorkingDay(); // false
moment('2016-12-25T16:30:00Z').isWorkingDay(); // false
moment('2017-12-25T16:30:00Z').isWorkingDay(); // false
moment('2018-12-25T16:30:00Z').isWorkingDay(); // false
moment('2015-02-26T17:30:00').nextTransitionTime().moment; // $ExpectedType Moment
moment('2015-02-26T17:30:00').nextTransitionTime().transition; // $ExpectType "open" | "close"
moment('2015-02-26T17:30:00').lastTransitionTime().moment; // $ExpectedType Moment
moment('2015-02-26T17:30:00').lastTransitionTime().transition; // $ExpectType "open" | "close"

View File

@@ -1,6 +1,6 @@
{
"private": true,
"dependencies": {
"moment": ">=2.14.0"
"moment": "^2.24.0"
}
}