File tree 1 file changed +17
-1
lines changed
grails-app/assets/javascripts
1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 69
69
// a JS Date object - useful with datepicker; and
70
70
// a simple formatted date of the form dd-mm-yyyy useful for display.
71
71
// The formatted date will include hh:MM if the includeTime argument is true
72
- ko . extenders . simpleDate = function ( target , includeTime ) {
72
+ ko . extenders . simpleDate = function ( target , options ) {
73
+ var includeTime = false ;
74
+ var isReadOnly = false ;
75
+ if ( _ . isObject ( options ) ) {
76
+ includeTime = options . includeTime || false ;
77
+ isReadOnly = options . readOnly || false ;
78
+ }
79
+ else {
80
+ includeTime = options || false ;
81
+ }
82
+
73
83
target . date = ko . computed ( {
74
84
read : function ( ) {
75
85
return Date . fromISO ( target ( ) ) ;
76
86
} ,
77
87
78
88
write : function ( newValue ) {
89
+ if ( isReadOnly ) {
90
+ return ;
91
+ }
79
92
if ( newValue ) {
80
93
var current = target ( ) ,
81
94
valueToWrite = convertToIsoDate ( newValue ) ;
95
108
} ,
96
109
97
110
write : function ( newValue ) {
111
+ if ( isReadOnly ) {
112
+ return ;
113
+ }
98
114
if ( newValue ) {
99
115
var current = target ( ) ,
100
116
valueToWrite = convertToIsoDate ( newValue ) ;
You can’t perform that action at this time.
0 commit comments