Comments (17)
Can you paste part of your template for this directive.
It should normally convert with the format you specified with moment.
Which version of moment have you included?
currentDate = ngModel
scope.currentDate = moment(scope.currentDate, scope.format);
from angular-material-datetimepicker.
It must be a JavaScript ISO 8601 Date-Time:
"2017-09-20T15:00:00Z" or "2017-09-20T11:00:00-04:00"
You service returns a RFC3339 with a fractional second, but you can do:
var d = new Date("2017-09-12T18:30:00.000Z");
from angular-material-datetimepicker.
thank you for your reply @hexadecy ... after getting the response can you tell me how i need to change the date/time...like you want me to do like new date(Response_Date_variable) for all the dates
from angular-material-datetimepicker.
Please check your depedencies, I cannot reproduce it.
from angular-material-datetimepicker.
@hexadecy ...actually i am directly assigning the response to the $scope model...i am not formatting the date...you want me to format with moment and assign...?
from angular-material-datetimepicker.
What error you have in F12 dev console?
$scope.myDateTime = "2017-09-12T18:30:00.000Z" is a valid date.
Because RFC3339 is a sub-profile of ISO 8601, so my first guest was wrong.
The date is always formatted by moment in this project, you don't have to format it before.
But make sure you have the right version:
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.6/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.6/angular-animate.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.6/angular-aria.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/angular-material/1.1.5/angular-material.min.css" rel="stylesheet" type="text/css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-material/1.1.5/angular-material.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment-with-locales.min.js"></script>
from angular-material-datetimepicker.
i am getting "2017-09-12T18:30:00.000Z" this format from my service response ...i will check for the right versions and will get back to you ..thank you for your reply @hexadecy
from angular-material-datetimepicker.
Pretty similar to one issue you have in the past: logbon72#109
AngularJS, angular-animate, angular-aria must be on the same version.
I'm only testing recent version, if you can't be on the latest version let me know.
from angular-material-datetimepicker.
@bhargavmullakuru resolved?
from angular-material-datetimepicker.
Error: [ngRepeat:dupes] Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: itemMonth in picker.monthsAvailable(), Duplicate key: string:Invalid date, Duplicate value: Invalid date
@hexadecy This error i am getting in my Dev console..i have used the same versions that you commented above
from angular-material-datetimepicker.
@hexadecy i am using moment version 2.10.3
from angular-material-datetimepicker.
Month picker is new since beenote/angular-material-datetimepicker v1.8.4 and you need at least Angular Material 1.1.2 because of new $mdMenu.
from angular-material-datetimepicker.
I still cannot reproduce it... try this, I will make a version if you confirm me it's ok.
https://github.com/beenote/angular-material-datetimepicker/blob/gh-pages/js/angular-material-datetimepicker.js#L37
change to:
<md-menu-item ng-repeat="itemMonth in picker.monthsAvailable() track by $index">
from angular-material-datetimepicker.
@hexadecy ..thanks for your patience with my issue ... i am using angular-aria v1.4.8 and AngularJS v1.3.13... and i included latest cdn of DateTimePicker v1.9.3 .....
i am getting error of " angular.js:11607 Error: [$injector:unpr] Unknown provider: $$mdSvgRegistryProvider <- $$mdSvgRegistry <- mdcDatetimePickerDirective "
from angular-material-datetimepicker.
$$mdSvgRegistry is not included with angular-material v1.1.0-rc1
I included the calendar icon with a svg in base64 in DateTimePicker v1.9.4
I still think that you issue is in the parsing with moment, have you tried with moment 2.18.1 and with moment-with-locales.
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment-with-locales.min.js"></script>
Also are you using min-date and max-date properties?
And are you using $http to query your data service in json format?
from angular-material-datetimepicker.
@hexadecy ... I have converted this date "2017-09-12T18:30:00.000Z"to new Date("2017-09-12T18:30:00.000Z") ...in the response...it is working fine now.. i think the issue was parsing the time stamp to ISO string
from angular-material-datetimepicker.
🎉 @hexadecy thank-you for taking time and helping me on this Issue 👍
from angular-material-datetimepicker.
Related Issues (20)
- min time and max time HOT 1
- Add mdDialog hasBackdrop option HOT 4
- Add am/pm text customization HOT 2
- Do you have this in a non-angular version? HOT 1
- Could not find a declaration HOT 1
- Setting shortTime=true on a date picker shows AM/PM indicator HOT 4
- Picker icons cause layout issues, show-icon enables too many options HOT 8
- Month displayed is not the same as month view HOT 5
- Upgrade angular library HOT 1
- Cannot set default values for all params of the directive. HOT 1
- Support clearing date from dialog HOT 2
- unable to load datetime picker on dialog box. HOT 5
- ng-change not being triggered as expected and validation failing HOT 5
- If ng-disabled is true. Input field is disabled but buttons are not HOT 4
- Date part is lost when editing time HOT 4
- Which Angular Version? HOT 1
- Option to edit both date and time at the same time on dialog? HOT 1
- Not compatible with Angular 1.8
- User cannot use blue bubble on the clock to set time on Firefox HOT 1
- Min/max date comparison is apparently not timezone-safe HOT 2
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 angular-material-datetimepicker.