@tap-payments/os-micro-frontend-shared 0.1.365-test.27 → 0.1.365-test.28

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.
@@ -249,24 +249,32 @@ export const getDateLabel = (from, to) => {
249
249
  const today = dayjs().startOf('day');
250
250
  const currentYear = today.year();
251
251
  const diffDays = end.diff(start, 'day') + 1;
252
+ // Today / Yesterday
252
253
  if (start.isToday() && end.isToday())
253
254
  return { label: 'Today', isCustom: false };
254
255
  if (start.isYesterday() && end.isYesterday())
255
256
  return { label: 'Yesterday', isCustom: false };
256
- if (diffDays === 7 && end.isSame(today, 'day')) {
257
+ // Last 7 days
258
+ if (diffDays === 7 && end.isSame(today, 'day'))
257
259
  return { label: 'Last 7 days', isCustom: false };
258
- }
259
260
  // Last 30 days (inclusive)
260
261
  if (diffDays === 31 && end.isSame(today, 'day'))
261
262
  return { label: 'Last 30 days', isCustom: false };
263
+ // Full month
262
264
  if (start.date() === 1 && end.date() === end.daysInMonth() && start.month() === end.month()) {
263
265
  const monthLabel = start.year() === currentYear ? start.format('MMMM') : start.format('MMMM YYYY');
264
266
  return { label: monthLabel, isCustom: false };
265
267
  }
268
+ // Same day: show Month + Day
269
+ if (start.isSame(end, 'day')) {
270
+ const label = start.format(start.year() === currentYear ? 'MMM D' : 'MMM D YYYY');
271
+ return { label, isCustom: false };
272
+ }
273
+ // Custom range
266
274
  const showStartYear = start.year() !== currentYear;
267
275
  const showEndYear = end.year() !== currentYear;
268
- const startLabel = start.format(`MMM D${showStartYear ? ', YYYY' : ''}`);
269
- const endLabel = end.format(`MMM D${showEndYear ? ', YYYY' : ''}`);
276
+ const startLabel = start.format(`MMM D${showStartYear ? ' YYYY' : ''}`);
277
+ const endLabel = end.format(`MMM D${showEndYear ? ' YYYY' : ''}`);
270
278
  return {
271
279
  label: `${startLabel} – ${endLabel}`,
272
280
  isCustom: true,
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@tap-payments/os-micro-frontend-shared",
3
3
  "description": "Shared components and utilities for Tap Payments micro frontends",
4
- "version": "0.1.365-test.27",
5
- "testVersion": 27,
4
+ "version": "0.1.365-test.28",
5
+ "testVersion": 28,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",