@weni/unnnic-system 3.34.1 → 3.34.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weni/unnnic-system",
3
- "version": "3.34.1",
3
+ "version": "3.34.2",
4
4
  "type": "commonjs",
5
5
  "files": [
6
6
  "dist",
@@ -879,7 +879,10 @@ function getStartAndEndDateByPeriod(period: string) {
879
879
  const daysMatch = period.match(/^last-(\d+)-days$/);
880
880
  const monthsMatch = period.match(/^last-(\d+)-months$/);
881
881
 
882
- if (daysMatch) {
882
+ if (period === 'today') {
883
+ periodStartDate = dateToString(todayClone);
884
+ periodEndDate = dateToString(todayClone);
885
+ } else if (daysMatch) {
883
886
  const howMuch = Number(daysMatch[1]);
884
887
 
885
888
  periodEndDate = dateToString(todayClone);
@@ -95,6 +95,28 @@ describe('DatePicker.vue', () => {
95
95
  expect(updateEquivalent[0][0]).toBe('Last 7 days');
96
96
  });
97
97
 
98
+ it('submits with today period and emits equivalent option name', async () => {
99
+ wrapper = factory({
100
+ options: [
101
+ { name: 'Today', id: 'today' },
102
+ { name: 'Custom', id: 'custom' },
103
+ ],
104
+ });
105
+
106
+ await wrapper.vm.autoSelect('today');
107
+ await wrapper.find('[data-testid="date-picker-submit"]').trigger('click');
108
+
109
+ const submit = wrapper.emitted('submit');
110
+ const updateEquivalent = wrapper.emitted('update:equivalentOption');
111
+
112
+ expect(submit).toBeTruthy();
113
+ expect(submit[0][0]).toHaveProperty('startDate');
114
+ expect(submit[0][0]).toHaveProperty('endDate');
115
+ expect(submit[0][0].startDate).toBe(submit[0][0].endDate);
116
+
117
+ expect(updateEquivalent[0][0]).toBe('Today');
118
+ });
119
+
98
120
  it('submits with custom selection and clears equivalent option', async () => {
99
121
  wrapper.vm.optionSelected = 'custom';
100
122
  await wrapper.find('[data-testid="date-picker-submit"]').trigger('click');
@@ -28,6 +28,7 @@ const englishMonths = [
28
28
  const englishDays = ['S', 'M', 'T', 'W', 'T', 'F', 'S'];
29
29
 
30
30
  const englishPeriods: PeriodOption[] = [
31
+ { name: 'Today', id: 'today' },
31
32
  { name: 'Last 7 days', id: 'last-7-days' },
32
33
  { name: 'Last 14 days', id: 'last-14-days' },
33
34
  { name: 'Last 30 days', id: 'last-30-days' },
@@ -96,6 +97,10 @@ buttons.en = buttons['en-us'];
96
97
 
97
98
  export const periods: Record<string, PeriodOption[]> = {
98
99
  'pt-br': [
100
+ {
101
+ name: 'Hoje',
102
+ id: 'today',
103
+ },
99
104
  {
100
105
  name: 'Últimos 7 dias',
101
106
  id: 'last-7-days',
@@ -128,6 +133,10 @@ export const periods: Record<string, PeriodOption[]> = {
128
133
  en: englishPeriods,
129
134
  'en-us': englishPeriods,
130
135
  es: [
136
+ {
137
+ name: 'Hoy',
138
+ id: 'today',
139
+ },
131
140
  {
132
141
  name: 'Últimos 7 días',
133
142
  id: 'last-7-days',