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

Add Support of MM-DD-YYYY and DD-MM-YYYY on DateTimePicker #286

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ofceab
Copy link

@ofceab ofceab commented Jan 2, 2022

This pull request is for adding the feature which has been asked here #278
Thanks

@dhairya-lakhera
Copy link

I am unable to find document to show in dd-mm-yyyy format that means 01 Jan 2022 . It would be great if you can show some demo code for it. i am using the latest package version flutter_datetime_picker 1.5.1

@ofceab ofceab changed the title Added Support of MM-DD-YYYY and DD-MM-YYYY on DateTimePicker Add Support of MM-DD-YYYY and DD-MM-YYYY on DateTimePicker Mar 8, 2022
@ofceab
Copy link
Author

ofceab commented Mar 8, 2022

I am unable to find document to show in dd-mm-yyyy format that means 01 Jan 2022 . It would be great if you can show some demo code for it. i am using the latest package version flutter_datetime_picker 1.5.1

Hey @dhairya-lakhera
Thanks for you request, I'll add a demo for showing that
But currently even if you're using the latest version the pull request is not yet migrate to the master, you'll have to wait until it get migrate then you'll get that new feature.
In between I'll add the demo you asked for

@KawindaWAD
Copy link

KawindaWAD commented Sep 5, 2022

thank you @ofceab. you are life savior. it's working

@dhairya-lakhera you can use this feature as below

update pubspec.yaml

flutter_datetime_picker:
    git:
      url: https://github.com/internal-corp/flutter_datetime_picker.git
      ref: support_mm_dd_yyyy_date_format

add "datePickerFormat: DatePickerFormat.dd__mm__yyyy " to the code

Code example:

DatePicker.showDatePicker(context,
                      showTitleActions: true,
                      datePickerFormat: DatePickerFormat.dd__mm__yyyy,
                      minTime: DateTime(2018, 3, 5),
                      maxTime: DateTime(2019, 6, 7),
                      theme: DatePickerTheme(
                          headerColor: Colors.orange,
                          backgroundColor: Colors.blue,
                          itemStyle: TextStyle(
                              color: Colors.white,
                              fontWeight: FontWeight.bold,
                              fontSize: 18),
                          doneStyle:
                              TextStyle(color: Colors.white, fontSize: 16)),
                      onChanged: (date) {
                    print('change $date in time zone ' +
                        date.timeZoneOffset.inHours.toString());
                  }, onConfirm: (date) {
                    print('confirm $date');
                  }, currentTime: DateTime.now(), locale: LocaleType.de);

@ofceab
Copy link
Author

ofceab commented Sep 5, 2022

Cool thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants