@zentered/issue-forms-body-parser 2.2.0 → 3.0.0

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.
@@ -1,28 +0,0 @@
1
- 'use strict'
2
-
3
- import { parse, isMatch } from 'date-fns'
4
- import { zonedTimeToUtc, formatInTimeZone } from 'date-fns-tz'
5
-
6
- const loc = 'UTC'
7
- const commonTimeFormats = [
8
- 'HH:mm',
9
- 'HH.mm',
10
- 'hh:mm aaa',
11
- 'hh:mm a..aa',
12
- 'hh:mm aaaa'
13
- ]
14
-
15
- export default function parseTime(text) {
16
- const match = commonTimeFormats.map((format) => {
17
- return isMatch(text, format)
18
- })
19
- if (match.indexOf(true) > -1) {
20
- const time = zonedTimeToUtc(
21
- parse(text, commonTimeFormats[match.indexOf(true)], new Date()),
22
- loc
23
- )
24
- return formatInTimeZone(time, loc, 'HH:mm')
25
- } else {
26
- return null
27
- }
28
- }