MCPcopy
hub / github.com/msgbyte/tianji / formatDateWithUnit

Function formatDateWithUnit

src/client/utils/date.ts:60–74  ·  view source on GitHub ↗
(val: dayjs.ConfigType, unit: DateUnit)

Source from the content-addressed store, hash-verified

58}
59
60export function formatDateWithUnit(val: dayjs.ConfigType, unit: DateUnit) {
61 if (unit === 'minute') {
62 return dayjs(val).format('HH:mm');
63 } else if (unit === 'hour') {
64 return dayjs(val).format('HA');
65 } else if (unit === 'day') {
66 return dayjs(val).format('MMM DD');
67 } else if (unit === 'month') {
68 return dayjs(val).format('MMM');
69 } else if (unit === 'year') {
70 return dayjs(val).format('YYYY');
71 }
72
73 return formatDate(val);
74}
75
76function formatOffset(offset: number) {
77 const sign = offset >= 0 ? '+' : '-';

Callers 2

TimeEventChart.tsxFile · 0.90

Calls 1

formatDateFunction · 0.70

Tested by

no test coverage detected