@beauraines/toggl-cli 0.10.19 → 0.10.20

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/CHANGELOG.md CHANGED
@@ -2,12 +2,21 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
- ### [0.10.19](https://github.com/beauraines/toggl-cli/compare/v0.10.18...v0.10.19) (2023-06-12)
5
+ ### [0.10.20](https://github.com/beauraines/toggl-cli/compare/v0.10.19...v0.10.20) (2023-07-08)
6
+
7
+ ### [0.10.19](https://github.com/beauraines/toggl-cli/compare/v0.10.18...v0.10.19) (2023-07-08)
8
+
9
+
10
+ ### Features
11
+
12
+ * **weekly report:** Add weekly report options ([73bb7fe](https://github.com/beauraines/toggl-cli/commit/73bb7fe8b815978feb39de5db4b6cc96811314cf)), closes [#44](https://github.com/beauraines/toggl-cli/issues/44)
6
13
 
7
14
 
8
15
  ### Bug Fixes
9
16
 
10
17
  * **deps:** bump dayjs from 1.11.7 to 1.11.8 ([2b47fde](https://github.com/beauraines/toggl-cli/commit/2b47fde79a538cfe6a486e84a21e58cfa2ddd6b4))
18
+ * **deps:** bump dotenv from 16.1.3 to 16.1.4 ([14eaefa](https://github.com/beauraines/toggl-cli/commit/14eaefa93394e93708dc05319db73d86ac6fe9e5))
19
+ * **deps:** bump dotenv from 16.1.4 to 16.3.1 ([#83](https://github.com/beauraines/toggl-cli/issues/83)) ([6511956](https://github.com/beauraines/toggl-cli/commit/65119569c782afd7d22ae2532b23568d7517bc2a))
11
20
 
12
21
  ### [0.10.18](https://github.com/beauraines/toggl-cli/compare/v0.10.17...v0.10.18) (2023-06-03)
13
22
 
package/cmds/weekly.mjs CHANGED
@@ -15,13 +15,21 @@ const debug = debugClient('toggl-cli-week');
15
15
  export const command = 'week'
16
16
  // FIXME descriptions
17
17
  export const desc = 'Weekly project summary by day'
18
- export const builder = {}
18
+ export const builder = {
19
+ p: { alias: ['previous','prior'], describe: 'Return the prior week\'s data', type: 'boolean', demandOption: false, requiresArg: false}
20
+ }
19
21
 
20
22
  export const handler = async function (argv) {
21
23
  const client = Client()
22
24
  const workspace = await getWorkspace()
23
25
 
24
- const params = { } // Leave this for future options, like rounding
26
+ const weekOffset = argv.previous ? 1 : 0
27
+ const startDate = dayjs().startOf('week').subtract(weekOffset,'weeks')
28
+
29
+ const params = {
30
+ start_date: startDate.format('YYYY-MM-DD')
31
+ }
32
+
25
33
  const weeklyReport = await client.reports.weekly(workspace.id, params)
26
34
  debug(weeklyReport)
27
35
  const reportData = []
@@ -36,11 +44,11 @@ export const handler = async function (argv) {
36
44
 
37
45
  for (let i = 0; i < project.seconds.length; i++) {
38
46
  const element = project.seconds[i]
39
- const date = dayjs().startOf('week').add(i, 'days').format('ddd MM-DD')
47
+ const date = startDate.add(i, 'days').format('ddd MM-DD')
40
48
  const duration = element || 0
41
49
  row[date] = formatDuration(duration * 1000)
42
50
  totals[i] += duration // for use with a daily total row
43
- row.Total += duration // accumulate the projects weekly totoal
51
+ row.Total += duration // accumulate the projects weekly total
44
52
  }
45
53
  reportData.push(row)
46
54
  }
@@ -52,9 +60,9 @@ export const handler = async function (argv) {
52
60
 
53
61
  for (let i = 0; i < totals.length; i++) {
54
62
  const seconds = totals[i]
55
- const date = dayjs().startOf('week').add(i, 'days').format('ddd MM-DD')
63
+ const date = startDate.add(i, 'days').format('ddd MM-DD')
56
64
  totalRow[date] = formatDuration(seconds * 1000)
57
- totalRow.Total += seconds // accumulate the projects weekly totoal
65
+ totalRow.Total += seconds // accumulate the projects weekly total
58
66
  }
59
67
  reportData.push(totalRow)
60
68
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beauraines/toggl-cli",
3
- "version": "0.10.19",
3
+ "version": "0.10.20",
4
4
  "description": "",
5
5
  "main": "cli.js",
6
6
  "bin": {