Skip to content

Commit

Permalink
feat: Upgrade date-fns to 2.30.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Merkur39 committed Dec 20, 2024
1 parent 1b67de2 commit a1a934b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
"cozy-stack-client": "^51.6.0",
"cozy-ui": "^114.0.1",
"cozy-viewer": "^10.0.0",
"date-fns": "1.30.1",
"date-fns": "2.30.0",
"diacritics": "1.3.0",
"filesize": "10.1.6",
"leaflet": "1.9.4",
Expand Down
14 changes: 10 additions & 4 deletions src/lib/dacc/dacc-run.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { endOfMonth, startOfMonth, format, subMonths } from 'date-fns'
import endOfMonth from 'date-fns/endOfMonth'
import format from 'date-fns/format'
import startOfMonth from 'date-fns/startOfMonth'
import subMonths from 'date-fns/subMonths'

import CozyClient from 'cozy-client'
import flag from 'cozy-flags'
Expand Down Expand Up @@ -36,17 +39,20 @@ export const run = async () => {

const aggregationDate = new Date(
maxFileDateQuery || endOfMonth(subMonths(new Date(), 1))
).toISOString()
)

const sizesBySlug = await aggregateFilesSize(client, aggregationDate, {
excludedSlug,
nonExcludedGroupLabel
})
if (Object.keys(sizesBySlug).length < 1) {
log('info', `No files found to aggregate with date ${aggregationDate}`)
log(
'info',
`No files found to aggregate with date ${aggregationDate.toISOString()}`
)
}

const startDateMeasure = format(startOfMonth(aggregationDate), 'YYYY-MM-DD')
const startDateMeasure = format(startOfMonth(aggregationDate), 'yyyy-LL-dd')

await sendToRemoteDoctype(client, remoteDoctype, sizesBySlug, {
measureName,
Expand Down
9 changes: 4 additions & 5 deletions src/lib/dacc/dacc-run.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { endOfMonth, subMonths } from 'date-fns'
import endOfMonth from 'date-fns/endOfMonth'
import subMonths from 'date-fns/subMonths'

import CozyClient from 'cozy-client'
import flag from 'cozy-flags'
Expand All @@ -14,7 +15,7 @@ jest.mock('lib/dacc/dacc')

describe('dacc', () => {
const maxGivenDate = '2022-01-01'
const maxDate = new Date(maxGivenDate).toISOString()
const maxDate = new Date(maxGivenDate)
beforeEach(() => {
flag.mockReturnValue({
excludedSlug: 'excludedSlug',
Expand Down Expand Up @@ -67,9 +68,7 @@ describe('dacc', () => {
measureName: 'measureName',
remoteDoctype: 'remoteDoctype'
})
const endOfThisMonth = new Date(
endOfMonth(subMonths(new Date(), 1))
).toISOString()
const endOfThisMonth = new Date(endOfMonth(subMonths(new Date(), 1)))

// When
await run()
Expand Down
12 changes: 6 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7066,23 +7066,23 @@ data-view-byte-offset@^1.0.0:
es-errors "^1.3.0"
is-data-view "^1.0.1"

[email protected], date-fns@^1.28.5, date-fns@^1.30.1:
version "1.30.1"
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.30.1.tgz#2e71bf0b119153dbb4cc4e88d9ea5acfb50dc05c"
integrity sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==

[email protected]:
version "2.29.3"
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.29.3.tgz#27402d2fc67eb442b511b70bbdf98e6411cd68a8"
integrity sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA==

date-fns@^2.22.1:
date-fns@2.30.0, date-fns@^2.22.1:
version "2.30.0"
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.30.0.tgz#f367e644839ff57894ec6ac480de40cae4b0f4d0"
integrity sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==
dependencies:
"@babel/runtime" "^7.21.0"

date-fns@^1.28.5, date-fns@^1.30.1:
version "1.30.1"
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.30.1.tgz#2e71bf0b119153dbb4cc4e88d9ea5acfb50dc05c"
integrity sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==

debounce@^1.2.0:
version "1.2.1"
resolved "https://registry.yarnpkg.com/debounce/-/debounce-1.2.1.tgz#38881d8f4166a5c5848020c11827b834bcb3e0a5"
Expand Down

0 comments on commit a1a934b

Please sign in to comment.