Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #3 from vpegado/vp-fix-date-safari
Update angular-file-directive.js
  • Loading branch information
vpegado committed Nov 7, 2016
2 parents e84ba4d + 371198b commit 0aeb3dd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
11 changes: 10 additions & 1 deletion angular-file-directive.js
Expand Up @@ -7,6 +7,15 @@ angular.module('ngFile', [])
file: '='
},
link: function (scope, elem) {
function getFileModifiedDate (file) {
if (file.lastModifiedDate) {
return file.lastModifiedDate.toJSON();
}
else if (file.lastModified) {
return new Date(file.lastModified).toJSON();
}
return new Date().toJSON();
}
// Listen for change in the input element
elem.bind('change', function (changeEvent) {
var files = [];
Expand All @@ -30,7 +39,7 @@ angular.module('ngFile', [])
}
// Compile data from file
files.push({
updatedAt: file.lastModifiedDate.toJSON(),
updatedAt: getFileModifiedDate(file),
size: file.size,
type: file.type,
name: file.name,
Expand Down
2 changes: 1 addition & 1 deletion bower.json
@@ -1,6 +1,6 @@
{
"name": "angular-file-directive",
"version": "1.3.0",
"version": "1.3.3",
"homepage": "https://github.com/vpegado/angular-file-directive",
"authors": [
"Victor Pegado <victor.pegado@kivra.com>"
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "angular-file-directive",
"version": "1.3.0",
"version": "1.3.3",
"homepage": "https://github.com/vpegado/angular-file-directive",
"authors": [
"Victor Pegado <victor.pegado@kivra.com>"
Expand Down

0 comments on commit 0aeb3dd

Please sign in to comment.