-
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Date picker #237
base: main
Are you sure you want to change the base?
Add Date picker #237
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #237 +/- ##
==========================================
+ Coverage 98.83% 98.85% +0.02%
==========================================
Files 71 74 +3
Lines 1625 1658 +33
Branches 484 489 +5
==========================================
+ Hits 1606 1639 +33
- Misses 18 19 +1
+ Partials 1 0 -1 ☔ View full report in Codecov by Sentry. |
@@ -15,6 +15,7 @@ export enum DisplayMode { | |||
*/ | |||
export enum MinimizeOutputFormat { | |||
TEXT = 'text', | |||
DATE_TIME = 'dateTime', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please rename to DATETIME to be consistent over plugins
describe('getDateInLocalTimeFormat', () => { | ||
it('formats date correctly for standard date', () => { | ||
const date = new Date('2025-01-09T00:00:00'); | ||
expect(getDateInLocalTimeFormat(date)).toBe('2025-01-09'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use toEqual
also for consistency
if (typeof date === 'string') { | ||
currentValue = date.split('T')[0]; | ||
} else { | ||
currentValue = isUseLocalTime ? getDateInLocalTimeFormat(date) : date.toISOString().split('T')[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use dateTimeFormat to format date string?
https://github.com/grafana/grafana/blob/9e8c1acd005b8ad0a8cc025cd633ef697047e1dd/packages/grafana-ui/src/components/DateTimePickers/DateTimePicker/DateTimePicker.tsx#L221
Resolves: #236