From c7b7cb716d85eb426698fea3501239bc4d25ce92 Mon Sep 17 00:00:00 2001 From: Kenneth Skovhede Date: Thu, 13 Oct 2016 22:33:35 +0200 Subject: [PATCH] Added hack to sanitize the time fields when Angular uses non-HTML5 support for This fixes #1513 --- Duplicati/Server/webroot/ngax/index.html | 3 ++- .../ngax/scripts/directives/timeFormatFixer.js | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 Duplicati/Server/webroot/ngax/scripts/directives/timeFormatFixer.js diff --git a/Duplicati/Server/webroot/ngax/index.html b/Duplicati/Server/webroot/ngax/index.html index 59dc0e2f5..d35b5884d 100755 --- a/Duplicati/Server/webroot/ngax/index.html +++ b/Duplicati/Server/webroot/ngax/index.html @@ -108,6 +108,7 @@ + @@ -228,7 +229,7 @@ -
+
diff --git a/Duplicati/Server/webroot/ngax/scripts/directives/timeFormatFixer.js b/Duplicati/Server/webroot/ngax/scripts/directives/timeFormatFixer.js new file mode 100644 index 000000000..56c69bd10 --- /dev/null +++ b/Duplicati/Server/webroot/ngax/scripts/directives/timeFormatFixer.js @@ -0,0 +1,16 @@ +// From: https://mark.zealey.org/2015/01/08/formatting-time-inputs-nicely-with-angularjs +backupApp.directive('ngModel', function( $filter ) { + return { + require: '?ngModel', + link: function(scope, elem, attr, ngModel) { + if( !ngModel ) + return; + if( attr.type !== 'time' ) + return; + + ngModel.$formatters.unshift(function(value) { + return value.replace(/:00\.000$/, '') + }); + } + } +}); \ No newline at end of file