Comments (15)
This is my solution in coffeescript that works both on iOS and Android
maxDate = if ionic.Platform.isIOS() then new Date() else (new Date()).valueOf()
from cordova-plugin-datepicker.
This is the sort of thing that cordova is supposed to shield the user from. It should be consistent across both platforms.
from cordova-plugin-datepicker.
Someone should mention this inside of the documents. @VitaliiBlagodir
from cordova-plugin-datepicker.
I can confirm, min and maxdate won't work on Android, but on iOS. I use moment.js to generate a specific JS-Date-Object.
$scope.minDate = moment().locale('de').subtract(90, 'years').toDate();
$scope.maxDate = moment().locale('de').subtract(13, 'years').toDate();
var options = {
date: new Date(),
doneButtonLabel: $scope.trans.SET,
cancelButtonLabel: $scope.trans.CLOSE,
doneButtonColor: '#f39200',
cancelButtonColor: '#000',
minDate: $scope.minDate,
maxDate: $scope.maxDate,
mode: 'date'
};
from cordova-plugin-datepicker.
Thank you for your support. Let me try this solution
-----Original Message-----
From: "Hirbod" [email protected]
Sent: 25-02-2015 08:42 AM
To: "VitaliiBlagodir/cordova-plugin-datepicker" [email protected]
Cc: "harikrishnan992" [email protected]
Subject: Re: [cordova-plugin-datepicker] minDate and MaxDate not working (#60)
I can confirm, min and maxdate won't work on Android, but on iOS. I use moment.js to generate a specific JS-Date-Object.
$scope.minDate = moment().locale('de').subtract(90, 'years').toDate();
$scope.maxDate = moment().locale('de').subtract(13, 'years').toDate();
var options = {
date: new Date(),
doneButtonLabel: $scope.trans.SET,
cancelButtonLabel: $scope.trans.CLOSE,
doneButtonColor: '#f39200',
cancelButtonColor: '#000',
minDate: $scope.minDate,
maxDate: $scope.maxDate,
mode: 'date'
};
—
Reply to this email directly or view it on GitHub.
from cordova-plugin-datepicker.
There is no solution. Just confirmed your bug
from cordova-plugin-datepicker.
@VitaliiBlagodir anny suggestion why min and maxdate are broken on Android, while they work fine on iOS?
from cordova-plugin-datepicker.
maxDate and minDate work on Android for me if I do Date.parse(new Date()) or (new Date()).valueOf() but not on iOS
from cordova-plugin-datepicker.
Thanks for your input @Yuripetusko, this is at least a good way to provide a fallback! Thank you very much. I've just installed Cordovas Device Plugin to check the system. Not really happy with that overhead, but at least, it works fine!
from cordova-plugin-datepicker.
I use OnsenUI, but they also have a platform detection. Thanks for the hint!
from cordova-plugin-datepicker.
Thanks @Yuripetusko, Your hint worked for me !
Used device.platform to check for OS being iOS or Android.
from cordova-plugin-datepicker.
As identified here:
http://forum.ionicframework.com/t/ngcordova-datepicker-show-twice/16158/11
minDate is a Date object for iOS and an integer for Android, so you need to account for that when using the plugin. For example, with Ionic Framework, do something like this:
minDate = ionic.Platform.isIOS() ? new Date() : (new Date()).valueOf();
datePickerOptions = {
date: new Date(),
minDate: minDate,
mode: 'date'
};
from cordova-plugin-datepicker.
While updating the documentation, can you change "integer" to "millisecond precision unix timestamp"? I was struggling until I found this issue because I was using second precision unix timestamps.
from cordova-plugin-datepicker.
How to format the date from "Mon Mar 04 2019" to "03/04/2019".Thanks.
from cordova-plugin-datepicker.
@jenkinssgs moment("Mon Mar 04 2019").format("MM/DD/YYYY")
from cordova-plugin-datepicker.
Related Issues (20)
- error :length =1 index =1
- Elements stopped showing in iOS13 HOT 7
- vulnerability and penetration testing report observation for date-picker plugin HOT 1
- ionic native Date Picker issue in ios app HOT 1
- allowOldDates & allowFutureDates do not work
- width issue on calendar! HOT 1
- Translate spanish HOT 1
- IOS darkmode HOT 2
- TimePicker issue in ionic app after updating to ios 14 beta release HOT 9
- date picker too smooth, , which leads to inaccurate date selection
- how to select seconds ?
- bug: TimePicker issue in ionic app after updating to ios 14 HOT 1
- DatePicker Not working after iOS14 upgrade HOT 9
- The App uses an insecure Random Number Generator. HOT 1
- Datepicker sometimes showing multiple "Today" entries HOT 1
- Datepicker is not visible as of ios version 14 HOT 2
- Cannot select other date rather than today's date. When the date is changed, it roll back to today. Cannot see the future date value too. HOT 1
- Value of date picker is not being set to the field for ios 16.4
- BSF Cordova Ecosystem Crowdfunding Plan
- Plugin is suddenly crashing on Pixel phones running Android 14
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cordova-plugin-datepicker.