@autobusal/utilities 0.0.3 → 0.0.4
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/date.tsx +9 -0
- package/index.ts +3 -2
- package/package.json +1 -1
package/date.tsx
CHANGED
|
@@ -34,4 +34,13 @@ export const differenceYears = (date: Date): number => {
|
|
|
34
34
|
|
|
35
35
|
// calculate the miliseconds from epoch
|
|
36
36
|
return Math.abs(difference.getUTCFullYear() - 1970);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const futureDate = (days: number): string => {
|
|
40
|
+
const today = new Date();
|
|
41
|
+
|
|
42
|
+
const dayAfter = new Date(today);
|
|
43
|
+
dayAfter.setDate(today.getDate() + days);
|
|
44
|
+
|
|
45
|
+
return prepareDate(dayAfter);
|
|
37
46
|
};
|
package/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createDate, prepareDate, getFormattedShort, differenceYears } from './date';
|
|
1
|
+
import { createDate, prepareDate, getFormattedShort, differenceYears, futureDate } from './date';
|
|
2
2
|
import { validate, display } from './form';
|
|
3
3
|
import getPosition from './map';
|
|
4
4
|
import { error, notify, success } from './notify';
|
|
@@ -13,5 +13,6 @@ export {
|
|
|
13
13
|
createDate,
|
|
14
14
|
prepareDate,
|
|
15
15
|
getFormattedShort,
|
|
16
|
-
differenceYears
|
|
16
|
+
differenceYears,
|
|
17
|
+
futureDate
|
|
17
18
|
};
|