MCPcopy Index your code
hub / github.com/TheAlgorithms/JavaScript / parseDate

Method parseDate

Dynamic-Programming/FindMonthCalendar.js:40–56  ·  view source on GitHub ↗
(date)

Source from the content-addressed store, hash-verified

38 }
39
40 parseDate(date) {
41 const dateAr = []
42 let block = ''
43 let i
44 for (i = 0; i < date.length; i++) {
45 if (date[i] === '/') {
46 dateAr.push(parseInt(block))
47 block = ''
48 continue
49 }
50 block += date[i]
51 }
52 dateAr.push(parseInt(block))
53 if (dateAr.length !== 2) throw new Error('Improper string encoding')
54 const dateOb = { month: dateAr[0], year: dateAr[1] }
55 return dateOb
56 }
57
58 isGreater(startDate, endDate) {
59 if (startDate.year > endDate.year) {

Callers 1

generateMonthCalMethod · 0.95

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected