-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
readable dates, durations, booleans on insights
- Loading branch information
Showing
9 changed files
with
121 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
import InputType from '@/_constants/enum-input-type'; | ||
|
||
const NOMINAL_INPUT_TYPES = [InputType.MultiSelect, InputType.Select]; | ||
const NOMINAL_INPUT_TYPES = [ | ||
InputType.Checkbox, | ||
InputType.MultiSelect, | ||
InputType.Select, | ||
]; | ||
|
||
export default NOMINAL_INPUT_TYPES; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
const formatDateTime = (input: Date | string) => | ||
const formatDateTime = ( | ||
input: Date | string, | ||
options?: Intl.DateTimeFormatOptions, | ||
) => | ||
(input instanceof Date ? input : new Date(input)).toLocaleString(undefined, { | ||
day: 'numeric', | ||
hour: 'numeric', | ||
hour12: true, | ||
minute: 'numeric', | ||
month: 'numeric', | ||
...options, | ||
}); | ||
|
||
export default formatDateTime; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import humanizeDuration from 'humanize-duration'; | ||
|
||
const humanizeDurationShort = humanizeDuration.humanizer({ | ||
delimiter: ' ', | ||
language: 'short', | ||
languages: { | ||
short: { | ||
d: () => 'd', | ||
h: () => 'h', | ||
m: () => 'm', | ||
mo: () => 'mo', | ||
ms: () => 'ms', | ||
s: () => 's', | ||
w: () => 'w', | ||
y: () => 'y', | ||
}, | ||
}, | ||
largest: 2, | ||
spacer: '', | ||
}); | ||
|
||
export default humanizeDurationShort; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters