diff --git a/.github/workflows/dhis2-verify-app.yml b/.github/workflows/dhis2-verify-app.yml index 7931c7bca..2d8aa4ca0 100644 --- a/.github/workflows/dhis2-verify-app.yml +++ b/.github/workflows/dhis2-verify-app.yml @@ -52,7 +52,7 @@ jobs: - name: Build run: yarn d2-app-scripts build - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: name: app-build path: | @@ -179,7 +179,7 @@ jobs: with: node-version: 14.x - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v4 with: name: app-build diff --git a/src/context-selection/period-selector-bar-item/period-selector-bar-item.js b/src/context-selection/period-selector-bar-item/period-selector-bar-item.js index 7c2db838b..38f6b16bb 100644 --- a/src/context-selection/period-selector-bar-item/period-selector-bar-item.js +++ b/src/context-selection/period-selector-bar-item/period-selector-bar-item.js @@ -11,7 +11,7 @@ import { usePeriodId, periodTypesMapping, yearlyFixedPeriodTypes, - isDateALessThanDateB, + isDateAGreaterThanDateB, } from '../../shared/index.js' import DisabledTooltip from './disabled-tooltip.js' import PeriodMenu from './period-menu.js' @@ -36,11 +36,13 @@ const getMaxYear = (dateLimit) => { // periods run up to, but not including dateLimit, so if limit is 1 January, max year is previous year // otherwise, max year is the year from the date limit const dateLimitYear = getYear(dateLimit) + try { const [year, month, day] = dateLimit.split('-') if (Number(month) === 1 && Number(day) === 1) { return Number(year) - 1 } + return dateLimitYear } catch (e) { console.error(e) return dateLimitYear @@ -50,7 +52,10 @@ const getMaxYear = (dateLimit) => { export const PeriodSelectorBarItem = () => { const { systemInfo = {} } = useConfig() const { calendar = 'gregory' } = systemInfo - const { eraYear: currentFullYear } = getNowInCalendar(calendar) + const { eraYear: nowEraYear, year: nowYear } = getNowInCalendar(calendar) + const currentFullYear = ['ethiopian', 'ethiopic'].includes(calendar) + ? nowEraYear + : nowYear const [periodOpen, setPeriodOpen] = useState(false) const [periodId, setPeriodId] = usePeriodId() @@ -117,7 +122,7 @@ export const PeriodSelectorBarItem = () => { // date comparison if ( - isDateALessThanDateB(endDate, dateLimit, { + isDateAGreaterThanDateB(endDate, dateLimit, { inclusive: true, calendar, }) diff --git a/src/context-selection/period-selector-bar-item/use-periods.js b/src/context-selection/period-selector-bar-item/use-periods.js index 503a5cc41..9678cc018 100644 --- a/src/context-selection/period-selector-bar-item/use-periods.js +++ b/src/context-selection/period-selector-bar-item/use-periods.js @@ -73,11 +73,14 @@ export default function usePeriods({ // date comparison if ( lastPeriodOfPrevYear && - // `${year}-01-01` <= lastPeriodOfPrevYear.endDate - isDateALessThanDateB(`${year}`, lastPeriodOfPrevYear.endDate, { - inclusive: true, - calendar, - }) + isDateALessThanDateB( + `${year}-01-01`, + lastPeriodOfPrevYear.endDate, + { + inclusive: true, + calendar, + } + ) ) { const [lastPeriodOfPrevYear] = generateFixedPeriods({ ...generateFixedPeriodsPayload, @@ -95,7 +98,7 @@ export default function usePeriods({ firstPeriodNextYear && // `${year + 1}-01-01` > firstPeriodNextYear.startDate isDateAGreaterThanDateB( - `${year + 1}`, + `${year + 1}-01-01`, firstPeriodNextYear.startDate, { inclusive: false, calendar } ) diff --git a/src/context-selection/period-selector-bar-item/year-navigator.js b/src/context-selection/period-selector-bar-item/year-navigator.js index 16e8f124d..8755206de 100644 --- a/src/context-selection/period-selector-bar-item/year-navigator.js +++ b/src/context-selection/period-selector-bar-item/year-navigator.js @@ -10,6 +10,7 @@ export default function YearNavigator({ onYearChange, calendar, }) { + // console.log('maxYear', maxYear) const startYear = startingYears[calendar] ?? startingYears.default return (
diff --git a/src/data-workspace/data-details-sidebar/audit-log.js b/src/data-workspace/data-details-sidebar/audit-log.js index 12d84ad26..63fddc183 100644 --- a/src/data-workspace/data-details-sidebar/audit-log.js +++ b/src/data-workspace/data-details-sidebar/audit-log.js @@ -80,10 +80,14 @@ export default function AuditLog({ item }) { - Date - User - Change + {i18n.t('Date')} + + + {i18n.t('User')} + + + {i18n.t('Change')} @@ -109,10 +113,7 @@ export default function AuditLog({ item }) { {created ? `${created .substring(0, 16) - .replace( - 'T', - ' ' - )} (${timezone})` + .replace('T', ' ')}` : null} {user} @@ -138,6 +139,14 @@ export default function AuditLog({ item }) { })} + {audits.length > 0 && ( +
+ {i18n.t( + 'audit dates are given in {{- timezone}} time', + { timezone } + )} +
+ )}
) diff --git a/src/data-workspace/data-details-sidebar/audit-log.module.css b/src/data-workspace/data-details-sidebar/audit-log.module.css index 17751dacc..ad3d386b4 100644 --- a/src/data-workspace/data-details-sidebar/audit-log.module.css +++ b/src/data-workspace/data-details-sidebar/audit-log.module.css @@ -47,4 +47,11 @@ .alignToEnd { text-align: right; +} + +.timeZoneNote { + margin-block-start: var(--spacers-dp4); + font-size: 12px; + line-height: 19px; + color: var(--colors-grey600); } \ No newline at end of file diff --git a/src/shared/date/get-now-in-calendar.js b/src/shared/date/get-now-in-calendar.js index 6e7426b39..8ac386837 100644 --- a/src/shared/date/get-now-in-calendar.js +++ b/src/shared/date/get-now-in-calendar.js @@ -10,8 +10,11 @@ const pad = (startValue, minLength, padString) => { } } -const stringifyDate = (temporalDate, long) => { - const shortDate = `${pad(temporalDate.eraYear, 4, '0')}-${pad( +const stringifyDate = (temporalDate, long, calendar) => { + const year = ['ethiopian', 'ethiopic'].includes(calendar) + ? temporalDate.eraYear + : temporalDate.year + const shortDate = `${pad(year, 4, '0')}-${pad( temporalDate.month, 2, '0' @@ -32,5 +35,5 @@ export const getNowInCalendarString = ({ long = false, }) => { const nowTemporal = getNowInCalendar(calendar, timezone) - return stringifyDate(nowTemporal, long) + return stringifyDate(nowTemporal, long, calendar) }