Skip to content
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

[Feature] Change first day of the week on the date-picker widget #6842

Closed
ayushpahwa opened this issue Aug 24, 2021 · 9 comments · Fixed by #9497
Closed

[Feature] Change first day of the week on the date-picker widget #6842

ayushpahwa opened this issue Aug 24, 2021 · 9 comments · Fixed by #9497
Assignees
Labels
App Viewers Pod This label assigns issues to the app viewers pod Community Reported issues reported by community members Date Picker Widget Enhancement New feature or request Good First Issue Good for newcomers hacktoberfest All issues that can be solved by the community during Hacktoberfest Low An issue that is neither critical nor breaks a user flow Verified When issue is retested post its fixed

Comments

@ayushpahwa
Copy link
Contributor

Summary

We should be able to change the first day of the week on the date picker widget.

Motivation

As requested by a user on discord.

@ayushpahwa ayushpahwa added the Enhancement New feature or request label Aug 24, 2021
@ayushpahwa ayushpahwa added Low An issue that is neither critical nor breaks a user flow App Viewers Pod This label assigns issues to the app viewers pod labels Aug 24, 2021
@areyabhishek areyabhishek added Community Reported issues reported by community members Date Picker Widget labels Aug 24, 2021
@Pranay105 Pranay105 added the Good First Issue Good for newcomers label Sep 22, 2021
@SatishGandham SatishGandham added the hacktoberfest All issues that can be solved by the community during Hacktoberfest label Oct 1, 2021
@Hyperion101010
Copy link

Looks good can i pick this up @ayushpahwa

@Nikhil-Nandagopal
Copy link
Contributor

Nikhil-Nandagopal commented Oct 1, 2021

Hi @Hyperion101010 , 👋 the issue is all yours! Do raise a PR within 4 days and read our Contributing.md

@OladapoAjala
Copy link

OladapoAjala commented Oct 15, 2021

Hello @Nikhil-Nandagopal are you still working on this?

@Nikhil-Nandagopal can I pick this up?

I have looked into this and come up with two possible solutions:

  1. We automatically detect the current locale of the user and render a calender based on the locale
  2. We have an input on the datepicker widget settings that allows the developer set the start date of the popup calender.

Let me know your thoughts.

@Nikhil-Nandagopal Nikhil-Nandagopal removed their assignment Oct 17, 2021
@Nikhil-Nandagopal
Copy link
Contributor

@OladapoAjala go for it! We can do both, detect the current locale and set that as the default as well as give the user an option

@OladapoAjala
Copy link

Hello @Nikhil-Nandagopal thanks for assigning this issue to me. There are a couple of challenges here tho:

Firstly

  1. the DateInput component doesn't support timezone
  2. to render the DateInput calender based on timezone, we need to manually set the locale props & pass in the necessary localUtils from moment
  3. for each locale passed, we need to import the locale data from moment (reference)
  4. this is somewhat impractical.

Secondly

  1. The Timezone component from blueprintjs seems like a good fit for the date picker widget
  2. kindly point me to any resource on how we handle adding a new property to a widget

something like Screenshot from 2021-10-18 12-17-54

@somangshu
Copy link
Contributor

somangshu commented Oct 20, 2021

@OladapoAjala to find existing property and add new once as well, Please take a look at the app/client/src/widgets/DatePickerWidget2/widget/index.tsx > getPropertyPaneConfig method.

This problem is resolved with the new property introduced by blueprint dayPickerProps which show the API for firstDayOfWeek which will let you change this, We can introduce this property in the propertyPane and set it to default=0

ref

@OladapoAjala
Copy link

Hello @somangshu thanks for the info.

I have solved this problem by passing in an object containing the firstDayOfWeek into the dayPickerProps into the DateInput component.

I am however stuck at implementing a drop-down in the date-picker property pane that dynamically passes values to the DateInput component (basically how do you access data from the property pane and pass it in as a prop into the widget's component?).

@somangshu
Copy link
Contributor

@OladapoAjala the property given in the widget is accessible in the component with this.props because its passed with the component in the getPageView() method of the widget. So you can pass your new property form the datePickerWidget2 > getPageView() > component and utilize this in the component

Let me know if you still have a question

@OladapoAjala
Copy link

Thanks @somangshu I'd work on this over the weekend and give a feedback soon, been a bit busy lately!

@techbhavin techbhavin self-assigned this Dec 27, 2021
@close-label close-label bot added the QA Needs QA attention label Dec 29, 2021
@chandannkumar chandannkumar added Verified When issue is retested post its fixed and removed QA Needs QA attention labels Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
App Viewers Pod This label assigns issues to the app viewers pod Community Reported issues reported by community members Date Picker Widget Enhancement New feature or request Good First Issue Good for newcomers hacktoberfest All issues that can be solved by the community during Hacktoberfest Low An issue that is neither critical nor breaks a user flow Verified When issue is retested post its fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.