diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000000000000000000000000000000000000..f1ce944c68429b3d6227c74580ba2c8ea6b58b38
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "src/modules/matlab-fame-io"]
+	path = src/modules/matlab-fame-io
+	url = ../../Enterprise/matlab-fame-io.git
diff --git a/README.md b/README.md
index ddcd26165b782f83d240b82af032b9d2047c5877..41e5a5fbdd88f89979dfb61dd8c3d431e8a6eacd 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-[![pipeline status](https://git.dynare.org/Dynare/dseries/badges/master/pipeline.svg)](https://git.dynare.org/Dynare/dseries/commits/master)
+[![pipeline status](https://git.dynare.org/Enterprise/dseries/badges/enterprise/pipeline.svg)](https://git.dynare.org/Enterprise/dseries/commits/enterprise)
 
 This MATLAB/Octave toolbox comes with two classes:
 
diff --git a/src/@dates/append.m b/src/@dates/append.m
index 231da9731b428446311601cce85927df0c3df09d..1bef79eccb3f8fe4f8b101c913635262930fa2c3 100644
--- a/src/@dates/append.m
+++ b/src/@dates/append.m
@@ -4,12 +4,12 @@ function o = append(o, d) % --*-- Unitary tests --*--
 %
 % INPUTS
 % - o [dates]
-% - a [dates or string] dates object with one element or string that can be interpreted as a date.
+% - d [dates,char]  date to be appended (if not a dates object, it must be a row char array that can be interpreted as a date).
 %
 % OUTPUTS
-% - o [dates] dates object containing dates defined in o and d.
+% - o [dates]       containing dates defined in o and d.
 
-% Copyright (C) 2012-2017 Dynare Team
+% Copyright © 2012-2020 Dynare Team
 %
 % This code is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -42,95 +42,97 @@ end
 o = copy(o);
 o.append_(d);
 
+return
+
 %@test:1
-%$ % Define some dates
-%$ B1 = '1953Q4';
-%$ B2 = '1950Q2';
-%$ B3 = '1950Q1';
-%$ B4 = '1945Q3';
-%$ B5 = '2009Q2';
-%$
-%$ % Define expected results.
-%$ e.time = [1945 3; 1950 1; 1950 2; 1953 4];
-%$ e.freq = 4;
-%$
-%$ % Call the tested routine.
-%$ d = dates(B4,B3,B2,B1);
-%$ try
-%$     d.append(dates(B5));
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ % Check the results.
-%$ if t(1)
-%$     t(2) = dassert(d.time,e.time);
-%$     t(3) = dassert(d.freq,e.freq);
-%$ end
-%$ T = all(t);
+% Define some dates
+B1 = '1953Q4';
+B2 = '1950Q2';
+B3 = '1950Q1';
+B4 = '1945Q3';
+B5 = '2009Q2';
+
+% Define expected results.
+e.time = [1945 3; 1950 1; 1950 2; 1953 4];
+e.freq = 4;
+
+% Call the tested routine.
+d = dates(B4,B3,B2,B1);
+try
+    d.append(dates(B5));
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+% Check the results.
+if t(1)
+    t(2) = isequal(d.time,e.time);
+    t(3) = isequal(d.freq,e.freq);
+end
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ % Define some dates
-%$ B1 = '1953Q4';
-%$ B2 = '1950Q2';
-%$ B3 = '1950Q1';
-%$ B4 = '1945Q3';
-%$ B5 = '2009q2';
-%$
-%$ % Define expected results.
-%$ e.time = [1945 3; 1950 1; 1950 2; 1953 4; 2009 2];
-%$ f.time = [1945 3; 1950 1; 1950 2; 1953 4];
-%$ e.freq = 4;
-%$
-%$ % Call the tested routine.
-%$ d = dates(B4,B3,B2,B1);
-%$ try
-%$     c = d.append(B5);
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ % Check the results.
-%$ if t(1)
-%$     t(2) = dassert(d.time,f.time);
-%$     t(3) = dassert(c.time,e.time);
-%$     t(4) = dassert(c.freq,e.freq);
-%$     t(5) = dassert(d.freq,e.freq);
-%$ end
-%$ T = all(t);
+% Define some dates
+B1 = '1953Q4';
+B2 = '1950Q2';
+B3 = '1950Q1';
+B4 = '1945Q3';
+B5 = '2009q2';
+
+% Define expected results.
+e.time = [1945 3; 1950 1; 1950 2; 1953 4; 2009 2];
+f.time = [1945 3; 1950 1; 1950 2; 1953 4];
+e.freq = 4;
+
+% Call the tested routine.
+d = dates(B4,B3,B2,B1);
+try
+    c = d.append(B5);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+% Check the results.
+if t(1)
+    t(2) = isequal(d.time,f.time);
+    t(3) = isequal(c.time,e.time);
+    t(4) = isequal(c.freq,e.freq);
+    t(5) = isequal(d.freq,e.freq);
+end
+T = all(t);
 %@eof:2
 
 %@test:3
-%$ % Define some dates
-%$ B1 = '1953Q4';
-%$ B2 = '1950Q2';
-%$ B3 = '1950Q1';
-%$ B4 = '1945Q3';
-%$ B5 = '2009q2';
-%$
-%$ % Define expected results.
-%$ e.time = [1945 3; 1950 1; 1950 2; 1953 4; 2009 2];
-%$ f.time = [1945 3; 1950 1; 1950 2; 1953 4];
-%$ e.freq = 4;
-%$
-%$ % Call the tested routine.
-%$ d = dates(B4,B3,B2,B1);
-%$ try
-%$     c = append(d, B5);
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ % Check the results.
-%$ if t(1)
-%$     t(2) = dassert(d.time,f.time);
-%$     t(3) = dassert(c.time,e.time);
-%$     t(4) = dassert(c.freq,e.freq);
-%$     t(5) = dassert(d.freq,e.freq);
-%$ end
-%$ T = all(t);
+% Define some dates
+B1 = '1953Q4';
+B2 = '1950Q2';
+B3 = '1950Q1';
+B4 = '1945Q3';
+B5 = '2009q2';
+
+% Define expected results.
+e.time = [1945 3; 1950 1; 1950 2; 1953 4; 2009 2];
+f.time = [1945 3; 1950 1; 1950 2; 1953 4];
+e.freq = 4;
+
+% Call the tested routine.
+d = dates(B4,B3,B2,B1);
+try
+    c = append(d, B5);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+% Check the results.
+if t(1)
+    t(2) = isequal(d.time,f.time);
+    t(3) = isequal(c.time,e.time);
+    t(4) = isequal(c.freq,e.freq);
+    t(5) = isequal(d.freq,e.freq);
+end
+T = all(t);
 %@eof:3
diff --git a/src/@dates/append_.m b/src/@dates/append_.m
index 2c4a3a8de26826ebafb175c6518c71f998382481..5b676d13656a9e7ac6893102bddaf94485699182 100644
--- a/src/@dates/append_.m
+++ b/src/@dates/append_.m
@@ -4,12 +4,12 @@ function o = append_(o, d) % --*-- Unitary tests --*--
 %
 % INPUTS
 % - o [dates]
-% - a [dates or string] dates object with one element or string that can be interpreted as a date.
+% - d [dates,char]  date to be appended (if not a dates object, it must be a row char array that can be interpreted as a date).
 %
 % OUTPUTS
 % - o [dates] dates object containing dates defined in o and d.
 
-% Copyright (C) 2012-2017 Dynare Team
+% Copyright © 2012-2020 Dynare Team
 %
 % This code is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -41,149 +41,191 @@ end
 
 o.time = [o.time; d.time];
 
+return
+
 %@test:1
-%$ % Define some dates
-%$ B1 = '1953Q4';
-%$ B2 = '1950Q2';
-%$ B3 = '1950Q1';
-%$ B4 = '1945Q3';
-%$ B5 = '2009Q2';
-%$
-%$ % Define expected results.
-%$ e.time = [1945 3; 1950 1; 1950 2; 1953 4; 2009 2];
-%$ e.freq = 4;
-%$
-%$ % Call the tested routine.
-%$ d = dates(B4,B3,B2,B1);
-%$ try
-%$     d.append_(dates(B5));
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ % Check the results.
-%$ if t(1)
-%$     t(2) = dassert(d.time,e.time);
-%$     t(3) = dassert(d.freq,e.freq);
-%$ end
-%$ T = all(t);
+% Define some dates
+B1 = '1953Q4';
+B2 = '1950Q2';
+B3 = '1950Q1';
+B4 = '1945Q3';
+B5 = '2009Q2';
+
+% Define expected results.
+e.time = [1945 3; 1950 1; 1950 2; 1953 4; 2009 2];
+e.freq = 4;
+
+% Call the tested routine.
+d = dates(B4,B3,B2,B1);
+try
+    d.append_(dates(B5));
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+% Check the results.
+if t(1)
+    t(2) = isequal(d.time,e.time);
+    t(3) = isequal(d.freq,e.freq);
+end
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ % Define some dates
-%$ B1 = '1953Q4';
-%$ B2 = '1950Q2';
-%$ B3 = '1950Q1';
-%$ B4 = '1945Q3';
-%$ B5 = '2009Q2';
-%$
-%$ % Define expected results.
-%$ e.time = [1945 3; 1950 1; 1950 2; 1953 4; 2009 2];
-%$ e.freq = 4;
-%$
-%$ % Call the tested routine.
-%$ d = dates(B4,B3,B2,B1);
-%$ try
-%$     d.append_(B5);
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ % Check the results.
-%$ if t(1)
-%$     t(2) = dassert(d.time,e.time);
-%$     t(3) = dassert(d.freq,e.freq);
-%$ end
-%$ T = all(t);
+% Define some dates
+B1 = '1953Q4';
+B2 = '1950Q2';
+B3 = '1950Q1';
+B4 = '1945Q3';
+B5 = '2009Q2';
+
+% Define expected results.
+e.time = [1945 3; 1950 1; 1950 2; 1953 4; 2009 2];
+e.freq = 4;
+
+% Call the tested routine.
+d = dates(B4,B3,B2,B1);
+try
+    d.append_(B5);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+% Check the results.
+if t(1)
+    t(2) = isequal(d.time,e.time);
+    t(3) = isequal(d.freq,e.freq);
+end
+T = all(t);
 %@eof:2
 
 %@test:3
-%$ % Define some dates
-%$ B1 = '1953Q4';
-%$ B2 = '1950Q2';
-%$ B3 = '1950Q1';
-%$ B4 = '1945Q3';
-%$ B5 = '2009Q2';
-%$
-%$ % Define expected results.
-%$ e.time = [1945 3; 1950 1; 1950 2; 1953 4; 2009 2];
-%$ e.freq = 4;
-%$
-%$ % Call the tested routine.
-%$ d = dates(B4,B3,B2,B1);
-%$ try
-%$     c = d.append_(B5);
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ % Check the results.
-%$ if t(1)
-%$     t(2) = dassert(d.time,e.time);
-%$     t(3) = dassert(c.time,e.time);
-%$     t(4) = dassert(d.freq,e.freq);
-%$     t(5) = dassert(c.freq,e.freq);
-%$ end
-%$ T = all(t);
+% Define some dates
+B1 = '1953Q4';
+B2 = '1950Q2';
+B3 = '1950Q1';
+B4 = '1945Q3';
+B5 = '2009Q2';
+
+% Define expected results.
+e.time = [1945 3; 1950 1; 1950 2; 1953 4; 2009 2];
+e.freq = 4;
+
+% Call the tested routine.
+d = dates(B4,B3,B2,B1);
+try
+    c = d.append_(B5);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+% Check the results.
+if t(1)
+    t(2) = isequal(d.time,e.time);
+    t(3) = isequal(c.time,e.time);
+    t(4) = isequal(d.freq,e.freq);
+    t(5) = isequal(c.freq,e.freq);
+end
+T = all(t);
 %@eof:3
 
 
 %@test:4
-%$ % Define some dates
-%$ B1 = '1953Q4';
-%$ B2 = '1950Q2';
-%$ B3 = '1950Q1';
-%$ B4 = '1945Q3';
-%$ B5 = '2009Q2';
-%$
-%$ % Call the tested routine.
-%$ d = dates(B4,B3);
-%$ e = dates(B1,B2,B5);
-%$ try
-%$     d.append_(e);
-%$     t(1) = false;
-%$ catch
-%$     t(1) = true;
-%$ end
-%$
-%$ T = all(t);
+% Define some dates
+B1 = '1953Q4';
+B2 = '1950Q2';
+B3 = '1950Q1';
+B4 = '1945Q3';
+B5 = '2009Q2';
+
+% Call the tested routine.
+d = dates(B4,B3);
+e = dates(B1,B2,B5);
+try
+    d.append_(e);
+    t(1) = false;
+catch
+    t(1) = true;
+end
+
+T = all(t);
 %@eof:4
 
 %@test:5
-%$ % Define some dates
-%$ B = '1950Q2';
-%$
-%$ % Call the tested routine.
-%$ d = dates(B);
-%$ try
-%$     d.append_('1950Q3');
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ if t(1)
-%$     t(2) = dassert(d.time, [1950 2; 1950 3]);
-%$ end
-%$
-%$ T = all(t);
+% Define some dates
+B = '1950Q2';
+
+% Call the tested routine.
+d = dates(B);
+try
+    d.append_('1950Q3');
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    t(2) = isequal(d.time, [1950 2; 1950 3]);
+end
+
+T = all(t);
 %@eof:5
 
 %@test:6
-%$ % Define some dates
-%$ B = '1950Q2';
-%$
-%$ % Call the tested routine.
-%$ d = dates(B);
-%$ try
-%$     d.append_('1950Z3');
-%$     t(1) = false;
-%$ catch
-%$     t(1) = true;
-%$ end
-%$
-%$ T = all(t);
+% Define some dates
+B = '1950Q2';
+
+% Call the tested routine.
+d = dates(B);
+try
+    d.append_('1950Z3');
+    t(1) = false;
+catch
+    t(1) = true;
+end
+
+T = all(t);
 %@eof:6
+
+%@test:7
+% Define some dates
+B1 = '2020-01-01';
+B2 = '2020-01-02';
+B3 = '2020-01-03';
+B4 = '2020-01-04';
+B5 = '2020-01-05';
+
+% Call the tested routine.
+d = dates(B4,B3);
+e = dates(B1,B2,B5);
+try
+    d.append_(e);
+    t(1) = false;
+catch
+    t(1) = true;
+end
+
+T = all(t);
+%@eof:7
+
+%@test:8
+% Define some dates
+B1 = '2020-01-01';
+B2 = '2020-01-02';
+B3 = '2020Q1';
+
+% Call the tested routine.
+d = dates(B1,B2);
+e = dates(B3);
+try
+    d.append_(e);
+    t(1) = false;
+catch
+    t(1) = true;
+end
+
+T = all(t);
+%@eof:8
diff --git a/src/@dates/char.m b/src/@dates/char.m
index fe41d6cb836a8ffe5f41151fb0404e26d8a2aac2..2d59e776b2fc4d8021dd969b06c384eb294566bc 100644
--- a/src/@dates/char.m
+++ b/src/@dates/char.m
@@ -8,7 +8,7 @@ function s = char(o) % --*-- Unitary tests --*--
 % OUTPUTS
 % - s  [string]
 
-% Copyright (C) 2014-2017 Dynare Team
+% Copyright © 2014-2020 Dynare Team
 %
 % This code is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -29,92 +29,94 @@ end
 
 s = date2string(o.time, o.freq);
 
+return
+
 %@test:1
-%$ % Define a dates object
-%$ o = dates('1950Q1');
-%$
-%$ % Call the tested routine.
-%$ try
-%$     str = char(o);
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ if t(1)
-%$     t(2) = dassert(str,'1950Q1');
-%$ end
-%$ T = all(t);
+% Define a dates object
+o = dates('1950Q1');
+
+% Call the tested routine.
+try
+    str = char(o);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    t(2) = isequal(str,'1950Q1');
+end
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ % Define a dates object
-%$ o = dates('1950M1');
-%$
-%$ % Call the tested routine.
-%$ try
-%$     str = char(o);
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ if t(1)
-%$     t(2) = dassert(str,'1950M1');
-%$ end
-%$ T = all(t);
+% Define a dates object
+o = dates('1950M1');
+
+% Call the tested routine.
+try
+    str = char(o);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    t(2) = isequal(str,'1950M1');
+end
+T = all(t);
 %@eof:2
 
 %@test:3
-%$ % Define a dates object
-%$ o = dates('1950W50');
-%$
-%$ % Call the tested routine.
-%$ try
-%$     str = char(o);
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ if t(1)
-%$     t(2) = dassert(str,'1950W50');
-%$ end
-%$ T = all(t);
+% Define a dates object
+o = dates('2020-10-01');
+
+% Call the tested routine.
+try
+    str = char(o);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    t(2) = isequal(str,'2020-10-01');
+end
+T = all(t);
 %@eof:3
 
 %@test:4
-%$ % Define a dates object
-%$ o = dates('1950Y');
-%$
-%$ % Call the tested routine.
-%$ try
-%$     str = char(o);
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ if t(1)
-%$     t(2) = dassert(str,'1950Y');
-%$ end
-%$ T = all(t);
+% Define a dates object
+o = dates('1950Y');
+
+% Call the tested routine.
+try
+    str = char(o);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    t(2) = isequal(str,'1950Y');
+end
+T = all(t);
 %@eof:4
 
 %@test:5
-%$ % Define a dates object
-%$ o = dates('1950A');
-%$
-%$ % Call the tested routine.
-%$ try
-%$     str = char(o);
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ if t(1)
-%$     t(2) = dassert(str,'1950Y');
-%$ end
-%$ T = all(t);
-%@eof:5
+% Define a dates object
+o = dates('1950A');
+
+% Call the tested routine.
+try
+    str = char(o);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    t(2) = isequal(str,'1950Y');
+end
+T = all(t);
+%@eof:5
\ No newline at end of file
diff --git a/src/@dates/colon.m b/src/@dates/colon.m
index fd989baf917770da21eeeb0017131cd46119fce3..e9bdc1a499a1720651d9a4cf3030cc7e490dc315 100644
--- a/src/@dates/colon.m
+++ b/src/@dates/colon.m
@@ -14,7 +14,7 @@ function q = colon(varargin) % --*-- Unitary tests --*--
 % 1. p must be greater than o if d>0.
 % 2. p and q are dates objects with one element.
 
-% Copyright (C) 2013-2020 Dynare Team
+% Copyright © 2013-2020 Dynare Team
 %
 % This code is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -67,7 +67,7 @@ end
 q = dates();
 
 % Compute the number of elements in the returned dates object.
-n = (p-o)+1; % The number of elements in q dates object if d==1.    
+n = (p-o)+1; % The number of elements in q dates object if d==1.
 m = n;
 if d>1 % Correction of the number of elements (if d is not equal to one).
     m = length(1:d:n);
@@ -82,11 +82,11 @@ if isequal(q.freq, 1)
     q.time(:,1) = o.time(1)+transpose(0:d:n-1);
     q.time(:,2) = 1;
 elseif isequal(q.freq, 365)
-    q.time = NaN(n,3);
-    initperiods = datenum(o.time):datenum(p.time);
-    q.time = str2num(datestr(initperiods, 'yyyy mm dd'));
+    % Daily
+    q.time = NaN(m,2);
+    q.time(:,1) = o.time(1):d:p.time(1);
 else
-    % Weekly, Monthly, Quaterly, Bi-Annual
+    % Monthly, Quaterly, Bi-Annual
     q.time = NaN(n,2);
     initperiods = min(q.freq-o.time(2)+1,n);
     q.time(1:initperiods,1) = o.time(1);
@@ -112,102 +112,104 @@ else
     end
 end
 
+return
+
 %@test:1
-%$ % Define two dates
-%$ date_1 = '1950Q2';
-%$ date_2 = '1951Q4';
-%$
-%$ % Define expected results.
-%$ e.freq = 4;
-%$ e.time = [1950 2; 1950 3; 1950 4; 1951 1; 1951 2; 1951 3; 1951 4];
-%$
-%$ % Call the tested routine.
-%$ d1 = dates(date_1);
-%$ d2 = dates(date_2);
-%$ d3 = d1:d2;
-%$
-%$ % Check the results.
-%$ t(1) = dassert(d3.time,e.time);
-%$ t(2) = dassert(d3.freq,e.freq);
-%$ T = all(t);
+% Define two dates
+date_1 = '1950Q2';
+date_2 = '1951Q4';
+
+% Define expected results.
+e.freq = 4;
+e.time = [1950 2; 1950 3; 1950 4; 1951 1; 1951 2; 1951 3; 1951 4];
+
+% Call the tested routine.
+d1 = dates(date_1);
+d2 = dates(date_2);
+d3 = d1:d2;
+
+% Check the results.
+t(1) = isequal(d3.time, e.time);
+t(2) = isequal(d3.freq, e.freq);
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ % Define expected results.
-%$ e.freq = 4;
-%$ e.time = [1950 2; 1950 3; 1950 4; 1951 1; 1951 2; 1951 3; 1951 4];
-%$
-%$ % Call the tested routine.
-%$ d = dates('1950Q2'):dates('1951Q4');
-%$
-%$ % Check the results.
-%$ t(1) = dassert(d.time,e.time);
-%$ t(2) = dassert(d.freq,e.freq);
-%$ T = all(t);
+% Define expected results.
+e.freq = 4;
+e.time = [1950 2; 1950 3; 1950 4; 1951 1; 1951 2; 1951 3; 1951 4];
+
+% Call the tested routine.
+d = dates('1950Q2'):dates('1951Q4');
+
+% Check the results.
+t(1) = isequal(d.time, e.time);
+t(2) = isequal(d.freq, e.freq);
+T = all(t);
 %@eof:2
 
 %@test:3
-%$ % Define expected results.
-%$ e.freq = 4;
-%$ e.time = [1950 2; 1950 4; 1951 2; 1951 4];
-%$
-%$ % Call the tested routine.
-%$ d = dates('1950Q2'):2:dates('1951Q4');
-%$
-%$ % Check the results.
-%$ t(1) = dassert(d.time,e.time);
-%$ t(2) = dassert(d.freq,e.freq);
-%$ T = all(t);
+% Define expected results.
+e.freq = 4;
+e.time = [1950 2; 1950 4; 1951 2; 1951 4];
+
+% Call the tested routine.
+d = dates('1950Q2'):2:dates('1951Q4');
+
+% Check the results.
+t(1) = isequal(d.time, e.time);
+t(2) = isequal(d.freq, e.freq);
+T = all(t);
 %@eof:3
 
 
-%$ @test:3
-%$ % Create an empty dates object for quaterly data
-%$ qq = dates('Q');
-%$
-%$ % Define expected results.
-%$ e.freq = 4;
-%$ e.time = [1950 2; 1950 3; 1950 4; 1951 1; 1951 2; 1951 3; 1951 4];
-%$
-%$ % Call the tested routine.
-%$ d = qq(1950,2):qq(1951,4);
-%$
-%$ % Check the results.
-%$ t(1) = dassert(d.time,e.time);
-%$ t(2) = dassert(d.freq,e.freq);
-%$ T = all(t);
-%$ @eof:3
-
-%$ @test:4
-%$ % Create an empty dates object for quaterly data
-%$ qq = dates('Q');
-%$
-%$ % Define expected results.
-%$ e.freq = 4;
-%$ e.time = [1950 1; 1950 2; 1950 3];
-%$
-%$ % Call the tested routine.
-%$ d = qq(1950,1):qq(1950,3);
-%$
-%$ % Check the results.
-%$ t(1) = dassert(d.time,e.time);
-%$ t(2) = dassert(d.freq,e.freq);
-%$ T = all(t);
-%$ @eof:4
-
-%$ @test:5
-%$ % Create an empty dates object for daily data
-%$ dd = dates('D');
-%$
-%$ % Define expected results.
-%$ e.freq = 365;
-%$ e.time = [1950 1 28; 1950 1 29; 1950 1 30];
-%$
-%$ % Call the tested routine.
-%$ d = dd(1950, 01, 28):dd(1950, 01, 30);
-%$
-%$ % Check the results.
-%$ t(1) = dassert(d.time,e.time);
-%$ t(2) = dassert(d.freq,e.freq);
-%$ T = all(t);
-%$ @eof:5
+%@test:4
+% Create an empty dates object for quaterly data
+qq = dates('Q');
+
+% Define expected results.
+e.freq = 4;
+e.time = [1950 2; 1950 3; 1950 4; 1951 1; 1951 2; 1951 3; 1951 4];
+
+% Call the tested routine.
+d = qq(1950,2):qq(1951,4);
+
+% Check the results.
+t(1) = isequal(d.time, e.time);
+t(2) = isequal(d.freq, e.freq);
+T = all(t);
+%@eof:4
+
+%@test:5
+% Create an empty dates object for quaterly data
+qq = dates('Q');
+
+% Define expected results.
+e.freq = 4;
+e.time = [1950 1; 1950 2; 1950 3];
+
+% Call the tested routine.
+d = qq(1950,1):qq(1950,3);
+
+% Check the results.
+t(1) = isequal(d.time, e.time);
+t(2) = isequal(d.freq, e.freq);
+T = all(t);
+%@eof:5
+
+%@test:6
+% Create an empty dates object for daily data
+dd = dates('D');
+
+% Define expected results.
+e.freq = 365;
+e.time = [712251 NaN; 712252 NaN; 712253 NaN];
+
+% Call the tested routine.
+d = dd(1950, 01, 28):dd(1950, 01, 30);
+
+% Check the results.
+t(1) = isequal(d.time(:,1), e.time(:,1)) && all(isnan(d.time(:,2)));
+t(2) = isequal(d.freq, e.freq);
+T = all(t);
+%@eof:6
diff --git a/src/@dates/copy.m b/src/@dates/copy.m
index 3454125c2a32dd9470f590ead7bfb9d0982444d7..bbb1bf9048438b2f82eb7ccff66578c0e5788259 100644
--- a/src/@dates/copy.m
+++ b/src/@dates/copy.m
@@ -8,7 +8,7 @@ function p = copy(o) % --*-- Unitary tests --*--
 % OUTPUTS
 % - p [dates]
 
-% Copyright (C) 2014-2017 Dynare Team
+% Copyright © 2014-2020 Dynare Team
 %
 % This code is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -27,23 +27,25 @@ p = dates();
 p.freq = o.freq;
 p.time = o.time;
 
+return
+
 %@test:1
-%$ % Define a dates object
-%$ o = dates('1945Q3','1944Q4');
-%$ q = dates('1945Q3','1944Q4');
-%$
-%$ % Call the tested routine.
-%$ try
-%$     p = copy(o);
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ if t(1)
-%$      o.sort_();
-%$      t(2) = dassert(p, q);
-%$ end
-%$
-%$ T = all(t);
+% Define a dates object
+o = dates('1945Q3','1944Q4');
+q = dates('1945Q3','1944Q4');
+
+% Call the tested routine.
+try
+    p = copy(o);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+     o.sort_();
+     t(2) = dassert(p, q);
+end
+
+T = all(t);
 %@eof:1
\ No newline at end of file
diff --git a/src/@dates/dates.m b/src/@dates/dates.m
index a813b43ad90cf75b5879fba821c23f4be46dcc04..eb6e401ede6d95976846e76ca6ed623fed6b43e4 100644
--- a/src/@dates/dates.m
+++ b/src/@dates/dates.m
@@ -113,7 +113,7 @@ methods
             return
         end
         if isequal(nargin,4) && isfreq(varargin{1}) && isequal(varargin{1},365)
-            o.time = NaN(0,3);
+            o.time = NaN(0,2);
             if ischar(varargin{1})
                 o.freq = string2freq(varargin{1});
             else
@@ -123,7 +123,10 @@ methods
                 if isnumeric(varargin{3}) && isvector(varargin{3}) && all(isint(varargin{3}))
                     if isnumeric(varargin{4}) && isvector(varargin{4}) && all(isint(varargin{4}))
                         if all(varargin{3}>=1) && all(varargin{3}<=12) && all(varargin{4}>=1) && all(varargin{3}<=31)
-                            o.time = [varargin{2}(:), varargin{3}(:), varargin{4}(:)];
+                            if length(varargin{2})==length(varargin{3}) && length(varargin{2})==length(varargin{4})
+                                o.time = NaN(length(varargin{2}),2);
+                                o.time(:,1) = datenum(varargin{2}(:), varargin{3}(:), varargin{4}(:));
+                            end
                         else
                             error('dates:ArgCheck','Third input must contain integers between 1 and %i.', o.freq)
                         end
@@ -174,9 +177,9 @@ end % classdef
 %$ d = dates(B1,B2,B3,B4);
 %$
 %$ % Check the results.
-%$ t(1) = dassert(d.time, e.time);
-%$ t(2) = dassert(d.freq, e.freq);
-%$ t(3) = dassert(d.ndat(), size(e.time, 1));
+%$ t(1) = isequal(d.time, e.time);
+%$ t(2) = isequal(d.freq, e.freq);
+%$ t(3) = isequal(d.ndat(), size(e.time, 1));
 %$ T = all(t);
 %@eof:1
 
@@ -195,9 +198,9 @@ end % classdef
 %$ d = dates(B1,B2,B3,B4);
 %$
 %$ % Check the results.
-%$ t(1) = dassert(d.time,e.time);
-%$ t(2) = dassert(d.freq,e.freq);
-%$ t(3) = dassert(d.ndat(), size(e.time, 1));
+%$ t(1) = isequal(d.time,e.time);
+%$ t(2) = isequal(d.freq,e.freq);
+%$ t(3) = isequal(d.ndat(), size(e.time, 1));
 %$ T = all(t);
 %@eof:2
 
@@ -216,9 +219,9 @@ end % classdef
 %$ d = dates(B1,B2,B3,B4);
 %$
 %$ % Check the results.
-%$ t(1) = dassert(d.time,e.time);
-%$ t(2) = dassert(d.freq,e.freq);
-%$ t(3) = dassert(d.ndat(), size(e.time, 1));
+%$ t(1) = isequal(d.time,e.time);
+%$ t(2) = isequal(d.freq,e.freq);
+%$ t(3) = isequal(d.ndat(), size(e.time, 1));
 %$ T = all(t);
 %@eof:3
 
@@ -237,9 +240,9 @@ end % classdef
 %$ d = dates(B1,B2,B3,B4);
 %$
 %$ % Check the results.
-%$ t(1) = dassert(d.time, e.time);
-%$ t(2) = dassert(d.freq, e.freq);
-%$ t(3) = dassert(d.ndat(), size(e.time, 1));
+%$ t(1) = isequal(d.time, e.time);
+%$ t(2) = isequal(d.freq, e.freq);
+%$ t(3) = isequal(d.ndat(), size(e.time, 1));
 %$ T = all(t);
 %@eof:4
 
@@ -251,14 +254,14 @@ end % classdef
 %$ % Call the tested routine.
 %$ d = B(2);
 %$ if isa(d,'dates')
-%$     t(1) = 1;
+%$     t(1) = true;
 %$ else
-%$     t(1) = 0;
+%$     t(1) = false;
 %$ end
 %$
 %$ if t(1)
-%$     t(2) = dassert(d.freq,B.freq);
-%$     t(3) = dassert(d.time,[1950 2]);
+%$     t(2) = isequal(d.freq,B.freq);
+%$     t(3) = isequal(d.time,[1950 2]);
 %$ end
 %$ T = all(t);
 %@eof:5
@@ -271,14 +274,14 @@ end % classdef
 %$ % Call the tested routine.
 %$ d = B(2);
 %$ if isa(d,'dates')
-%$     t(1) = 1;
+%$     t(1) = true;
 %$ else
-%$     t(1) = 0;
+%$     t(1) = false;
 %$ end
 %$
 %$ if t(1)
-%$     t(2) = dassert(d.freq,B.freq);
-%$     t(3) = dassert(d.time,[1950 2]);
+%$     t(2) = isequal(d.freq,B.freq);
+%$     t(3) = isequal(d.time,[1950 2]);
 %$ end
 %$ T = all(t);
 %@eof:6
@@ -290,14 +293,14 @@ end % classdef
 %$ % Call the tested routine.
 %$ d = B(2);
 %$ if isa(d,'dates')
-%$     t(1) = 1;
+%$     t(1) = true;
 %$ else
-%$     t(1) = 0;
+%$     t(1) = false;
 %$ end
 %$
 %$ if t(1)
-%$     t(2) = dassert(d.freq,B.freq);
-%$     t(3) = dassert(d.time,[1950 2]);
+%$     t(2) = isequal(d.freq,B.freq);
+%$     t(3) = isequal(d.time,[1950 2]);
 %$ end
 %$ T = all(t);
 %@eof:7
@@ -309,14 +312,14 @@ end % classdef
 %$ % Call the tested routine.
 %$ d = B(2);
 %$ if isa(d,'dates')
-%$     t(1) = 1;
+%$     t(1) = true;
 %$ else
-%$     t(1) = 0;
+%$     t(1) = false;
 %$ end
 %$
 %$ if t(1)
-%$     t(2) = dassert(d.freq,B.freq);
-%$     t(3) = dassert(d.time,[1950 2]);
+%$     t(2) = isequal(d.freq,B.freq);
+%$     t(3) = isequal(d.time,[1950 2]);
 %$ end
 %$ T = all(t);
 %@eof:8
@@ -324,9 +327,9 @@ end % classdef
 %@test:9
 %$ try
 %$   B = dates(4,[1950; 1950], [1; 2]);
-%$   t = 1;
+%$   t = true;
 %$ catch
-%$   t = 0;
+%$   t = false;
 %$ end
 %$
 %$ T = all(t);
@@ -334,11 +337,11 @@ end % classdef
 
 %@test:10
 %$ try
-%$   B = dates(365,[1956, 1956], [1, 1], [12, 13]);
-%$   t = 1;
+%$   B = dates(365,[1956; 1956], [1; 1], [12; 13]);
+%$   t = true;
 %$ catch
-%$   t = 0;
+%$   t = false;
 %$ end
 %$
 %$ T = all(t);
-%@eof:10
+%@eof:10
\ No newline at end of file
diff --git a/src/@dates/double.m b/src/@dates/double.m
index 8ccae249902ff5aab8a91c539da392d6f7af275c..08e6165596a9b60388a55481f5b7aff0b712c201 100644
--- a/src/@dates/double.m
+++ b/src/@dates/double.m
@@ -8,12 +8,12 @@ function [m, f]  = double(o) % --*-- Unitary tests --*--
 %
 % OUTPUTS
 % - m [double] o.ndat*1 vector of doubles.
-% - f [integer] scalar, the frequency (1, 4, 12 or 52).
+% - f [integer] scalar, the frequency (1, 4, or 12).
 %
 % REMARKS
 %  Obviously the frequency is lost during the conversion.
 
-% Copyright (C) 2013-2017 Dynare Team
+% Copyright © 2013-2020 Dynare Team
 %
 % This code is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -28,48 +28,54 @@ function [m, f]  = double(o) % --*-- Unitary tests --*--
 % You should have received a copy of the GNU General Public License
 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
 
+if o.freq==365
+    error('This method is not implemented for daily frequency.')
+end
+
 m = o.time(:,1)+(o.time(:,2)-1)/o.freq;
 if nargout>1
     f = o.freq;
 end
 
+return
+
 %@test:1
-%$ % Define a dates object
-%$ B = dates('1950Q1'):dates('1951Q1');
-%$
-%$ % Call the tested routine.
-%$ try
-%$     C = double(B);
-%$     t(1) = 1;
-%$ catch
-%$     t(1) = 0;
-%$ end
-%$
-%$ % Define expected results.
-%$ E = [ones(4,1)*1950; 1951];
-%$ E = E + [(transpose(1:4)-1)/4; 0];
-%$ if t(1)
-%$     t(2) = dassert(C,E);
-%$ end
-%$ T = all(t);
+% Define a dates object
+B = dates('1950Q1'):dates('1951Q1');
+
+% Call the tested routine.
+try
+    C = double(B);
+    t(1) = 1;
+catch
+    t(1) = 0;
+end
+
+% Define expected results.
+E = [ones(4,1)*1950; 1951];
+E = E + [(transpose(1:4)-1)/4; 0];
+if t(1)
+    t(2) = isequal(C,E);
+end
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ % Call the tested routine.
-%$ try
-%$     C = NaN(2,1);
-%$     C(1) = double(dates('1950Q1'));
-%$     C(2) = double(dates('1950Q2'));
-%$     t(1) = 1;
-%$ catch
-%$     t(1) = 0;
-%$ end
-%$
-%$ % Define expected results.
-%$ E = ones(2,1)*1950;
-%$ E = E + [0; .25];
-%$ if t(1)
-%$     t(2) = dassert(C,E);
-%$ end
-%$ T = all(t);
+% Call the tested routine.
+try
+    C = NaN(2,1);
+    C(1) = double(dates('1950Q1'));
+    C(2) = double(dates('1950Q2'));
+    t(1) = 1;
+catch
+    t(1) = 0;
+end
+
+% Define expected results.
+E = ones(2,1)*1950;
+E = E + [0; .25];
+if t(1)
+    t(2) = isequal(C,E);
+end
+T = all(t);
 %@eof:2
\ No newline at end of file
diff --git a/src/@dates/eq.m b/src/@dates/eq.m
index 58ef96b7a062047fa3ecc9c05c232762d0cb855a..cece333b571e929db914b0e3654bf93296caca42 100644
--- a/src/@dates/eq.m
+++ b/src/@dates/eq.m
@@ -9,7 +9,7 @@ function l = eq(varargin) % --*-- Unitary tests --*--
 % OUTPUTS
 % - l [logical] column vector of max(n,1) elements (zeros or ones).
 
-% Copyright (C) 2013-2015 Dynare Team
+% Copyright © 2013-2020 Dynare Team
 %
 % This code is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -32,59 +32,114 @@ end
 [o, p] = comparison_arg_checks(varargin{:});
 
 if isequal(o.ndat(), p.ndat())
-    l = logical(transpose(all(transpose(eq(o.time,p.time)))));
+    if o.freq==365
+        l = eq(o.time(:,1),p.time(:,1));
+    else
+        l = logical(transpose(all(transpose(eq(o.time,p.time)))));
+    end
 else
-    l = logical(transpose(all(transpose(bsxfun(@eq,o.time,p.time)))));
+    if o.freq==365
+        l = bsxfun(@eq,o.time(:,1),p.time(:,1));
+    else
+        l = logical(transpose(all(transpose(bsxfun(@eq,o.time,p.time)))));
+    end
 end
 
+return
+
 %@test:1
-%$ % Define some dates objects
-%$ d1 = dates('1950Q1','1950Q2','1950Q3','1950Q4') ;
-%$ d2 = dates('1960Q1','1960Q2','1960Q3','1960Q4') ;
-%$ d3 = dates('1950Q1','1960Q2','1950Q3','1960Q4') ;
-%$
-%$ % Call the tested routine.
-%$ t1 = d1==d1;
-%$ t2 = d1==d2;
-%$ t3 = d1==d3;
-%$
-%$ % Check the results.
-%$ t(1) = dassert(t1,true(4,1));
-%$ t(2) = dassert(t2,false(4,1));
-%$ t(2) = dassert(t3,[true; false; true; false]);
-%$ T = all(t);
+% Define some dates objects
+d1 = dates('1950Q1','1950Q2','1950Q3','1950Q4') ;
+d2 = dates('1960Q1','1960Q2','1960Q3','1960Q4') ;
+d3 = dates('1950Q1','1960Q2','1950Q3','1960Q4') ;
+
+% Call the tested routine.
+try
+    t1 = d1==d1;
+    t2 = d1==d2;
+    t3 = d1==d3;
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+% Check the results.
+if t(1)
+    t(2) = isequal(t1, true(4,1));
+    t(3) = isequal(t2, false(4,1));
+    t(4) = isequal(t3, [true; false; true; false]);
+end
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ % Define some dates objects
-%$ d1 = dates('1950Q1') ;
-%$ d2 = dates('1960Q1') ;
-%$ d3 = dates('1960Q1') ;
-%$
-%$ % Call the tested routine.
-%$ t1 = d1==d1;
-%$ t2 = d1==d2;
-%$ t3 = d1==d3;
-%$
-%$ % Check the results.
-%$ t(1) = dassert(t1,true);
-%$ t(2) = dassert(t2,false);
-%$ t(2) = dassert(t3,false);
-%$ T = all(t);
+% Define some dates objects
+d1 = dates('1950Q1') ;
+d2 = dates('1960Q1') ;
+d3 = dates('1960Q1') ;
+
+% Call the tested routine.
+try
+    t1 = d1==d1;
+    t2 = d1==d2;
+    t3 = d1==d3;
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+% Check the results.
+if t(1)
+    t(2) = t1;
+    t(3) = ~t2;
+    t(4) = ~t3;
+end
+
+T = all(t);
 %@eof:2
 
 %@test:3
-%$ % Define some dates objects
-%$ d1 = dates('1950Q1','1950Q2','1950Q3','1950Q4') ;
-%$ d2 = dates('1950Q2') ;
-%$ d3 = dates('1970Q1') ;
-%$
-%$ % Call the tested routine.
-%$ t1 = d1==d2;
-%$ t2 = d1==d3;
-%$
-%$ % Check the results.
-%$ t(1) = dassert(t1,[false; true; false; false]);
-%$ t(2) = dassert(t2,false(4,1));
-%$ T = all(t);
+% Define some dates objects
+d1 = dates('1950Q1','1950Q2','1950Q3','1950Q4') ;
+d2 = dates('1950Q2') ;
+d3 = dates('1970Q1') ;
+
+% Call the tested routine.
+try
+    t1 = d1==d2;
+    t2 = d1==d3;
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+% Check the results.
+if t(1)
+    t(2) = isequal(t1, [false; true; false; false]);
+    t(3) = isequal(t2, false(4,1));
+end
+
+T = all(t);
 %@eof:3
+
+%@test:4
+% Define some dates objects
+d1 = dates('2000-01-01','2000-01-02','2000-01-03');
+d2 = dates('2000-01-02');
+
+
+% Call the tested routine.
+try
+    t1 = d1==d2;
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+% Check the results.
+if t(1)
+    t(2) = ~t1(1) && t1(2) && ~t1(3);
+end
+
+T = all(t);
+%@eof:4
\ No newline at end of file
diff --git a/src/@dates/ge.m b/src/@dates/ge.m
index 1edfba585983179e484105f293861e163818e135..3b5c6db2110b5217630f32d5ebfad1c7ea22db5f 100644
--- a/src/@dates/ge.m
+++ b/src/@dates/ge.m
@@ -3,13 +3,13 @@ function l = ge(varargin)  % --*-- Unitary tests --*--
 % Overloads the >= operator for dates objects.
 %
 % INPUTS
-% - o [dates] dates object with n or 1 elements.
-% - p [dates] dates object with n or 1 elements.
+% - o [dates]   object with n or 1 elements.
+% - p [dates]   object with n or 1 elements.
 %
 % OUTPUTS
 % - l [logical] column vector of max(n,1) elements (zeros or ones).
 
-% Copyright (C) 2013-2017 Dynare Team
+% Copyright © 2013-2020 Dynare Team
 %
 % This code is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -26,6 +26,11 @@ function l = ge(varargin)  % --*-- Unitary tests --*--
 
 [o, p] = comparison_arg_checks(varargin{:});
 
+if o.freq==365
+    l = o.time(:,1)>=p.time(:,1);
+    return
+end
+
 if isequal(o.ndat(), p.ndat())
     l = (o==p);
     idx = find(l==false);
@@ -46,50 +51,52 @@ else
     end
 end
 
+return
+
 %@test:1
-%$ % Define some dates
-%$ date_2 = '1950Q2';
-%$ date_3 = '1950Q3';
-%$ date_4 = '1950Q1';
-%$ date_5 = '1949Q2';
-%$
-%$ % Call the tested routine.
-%$ d2 = dates(date_2);
-%$ d3 = dates(date_3);
-%$ d4 = dates(date_4);
-%$ d5 = dates(date_5);
-%$ i1 = (d2>=d3);
-%$ i2 = (d3>=d4);
-%$ i3 = (d4>=d2);
-%$ i4 = (d5>=d4);
-%$ i5 = (d5>=d5);
-%$
-%$ % Check the results.
-%$ t(1) = dassert(i1,false);
-%$ t(2) = dassert(i2,true);
-%$ t(3) = dassert(i3,false);
-%$ t(4) = dassert(i4,false);
-%$ t(5) = dassert(i5,true);
-%$ T = all(t);
+% Define some dates
+date_2 = '1950Q2';
+date_3 = '1950Q3';
+date_4 = '1950Q1';
+date_5 = '1949Q2';
+
+% Call the tested routine.
+d2 = dates(date_2);
+d3 = dates(date_3);
+d4 = dates(date_4);
+d5 = dates(date_5);
+i1 = (d2>=d3);
+i2 = (d3>=d4);
+i3 = (d4>=d2);
+i4 = (d5>=d4);
+i5 = (d5>=d5);
+
+% Check the results.
+t(1) = isequal(i1,false);
+t(2) = isequal(i2,true);
+t(3) = isequal(i3,false);
+t(4) = isequal(i4,false);
+t(5) = isequal(i5,true);
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ % Define some dates
-%$ B1 = '1945Q1';
-%$ B2 = '1945Q2';
-%$ B3 = '1945Q3';
-%$ B4 = '1945Q4';
-%$ B5 = '1950Q1';
-%$
-%$ % Create dates objects.
-%$ dd = dates(B1,B2,B3,B4);
-%$
-%$ % Check the results.
-%$ t(1) = dassert(dates(B1)>=dates(B2),false);
-%$ t(2) = dassert(dates(B2)>=dates(B1),true);
-%$ t(3) = dassert(dates(B2)>=dates(B2),true);
-%$ t(4) = dassert(dd>=dates(B5),false(4,1));
-%$ t(5) = dassert(dates(B5)>=dd,true(4,1));
-%$ t(6) = dassert(dates(B1)>=dd,[true; false(3,1)]);
-%$ T = all(t);
+% Define some dates
+B1 = '1945Q1';
+B2 = '1945Q2';
+B3 = '1945Q3';
+B4 = '1945Q4';
+B5 = '1950Q1';
+
+% Create dates objects.
+dd = dates(B1,B2,B3,B4);
+
+% Check the results.
+t(1) = isequal(dates(B1)>=dates(B2),false);
+t(2) = isequal(dates(B2)>=dates(B1),true);
+t(3) = isequal(dates(B2)>=dates(B2),true);
+t(4) = isequal(dd>=dates(B5),false(4,1));
+t(5) = isequal(dates(B5)>=dd,true(4,1));
+t(6) = isequal(dates(B1)>=dd,[true; false(3,1)]);
+T = all(t);
 %@eof:2
diff --git a/src/@dates/gt.m b/src/@dates/gt.m
index 727aed0739dddcfe0191cb245d2c1e23d106f74b..609f3d6b645db2b89d4996a404667984fa41f3e9 100644
--- a/src/@dates/gt.m
+++ b/src/@dates/gt.m
@@ -3,13 +3,13 @@ function l = gt(varargin)  % --*-- Unitary tests --*--
 % Overloads the > operator for dates objects.
 %
 % INPUTS
-% - o [dates] dates object with n or 1 elements.
-% - p [dates] dates object with n or 1 elements.
+% - o [dates]   object with n or 1 elements.
+% - p [dates]   object with n or 1 elements.
 %
 % OUTPUTS
 % - l [logical] column vector of max(n,1) elements (zeros or ones).
 
-% Copyright (C) 2013-2015 Dynare Team
+% Copyright © 2013-2020 Dynare Team
 %
 % This code is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -26,6 +26,11 @@ function l = gt(varargin)  % --*-- Unitary tests --*--
 
 [o, p] = comparison_arg_checks(varargin{:});
 
+if o.freq==365
+    l = o.time(:,1)>p.time(:,1);
+    return
+end
+
 if isequal(o.ndat(), p.ndat())
     l = false(o.ndat(),1);
     for i=1:o.ndat()
@@ -45,48 +50,50 @@ else
     end
 end
 
+return
+
 %@test:1
-%$ % Define some dates
-%$ date_2 = '1950Q2';
-%$ date_3 = '1950Q3';
-%$ date_4 = '1950Q1';
-%$ date_5 = '1949Q2';
-%$
-%$ % Call the tested routine.
-%$ d2 = dates(date_2);
-%$ d3 = dates(date_3);
-%$ d4 = dates(date_4);
-%$ d5 = dates(date_5);
-%$ i1 = (d2>d3);
-%$ i2 = (d3>d4);
-%$ i3 = (d4>d2);
-%$ i4 = (d5>d4);
-%$
-%$ % Check the results.
-%$ t(1) = dassert(i1,false);
-%$ t(2) = dassert(i2,true);
-%$ t(3) = dassert(i3,false);
-%$ t(4) = dassert(i4,false);
-%$ T = all(t);
+% Define some dates
+date_2 = '1950Q2';
+date_3 = '1950Q3';
+date_4 = '1950Q1';
+date_5 = '1949Q2';
+
+% Call the tested routine.
+d2 = dates(date_2);
+d3 = dates(date_3);
+d4 = dates(date_4);
+d5 = dates(date_5);
+i1 = (d2>d3);
+i2 = (d3>d4);
+i3 = (d4>d2);
+i4 = (d5>d4);
+
+% Check the results.
+t(1) = isequal(i1,false);
+t(2) = isequal(i2,true);
+t(3) = isequal(i3,false);
+t(4) = isequal(i4,false);
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ % Define some dates
-%$ B1 = '1945Q1';
-%$ B2 = '1945Q2';
-%$ B3 = '1945Q3';
-%$ B4 = '1945Q4';
-%$ B5 = '1950Q1';
-%$
-%$ % Create dates objects.
-%$ dd = dates(B1,B2,B3,B4);
-%$
-%$ % Check the results.
-%$ t(1) = dassert(dates(B1)>dates(B2),false);
-%$ t(2) = dassert(dates(B2)>dates(B1),true);
-%$ t(3) = dassert(dates(B5)>dates(B1),true);
-%$ t(4) = dassert(dd>dates(B5),false(4,1));
-%$ t(5) = dassert(dates(B5)>dd,true(4,1));
-%$ t(6) = dassert(dates(B1)>dd,false(4,1));
-%$ T = all(t);
+% Define some dates
+B1 = '1945Q1';
+B2 = '1945Q2';
+B3 = '1945Q3';
+B4 = '1945Q4';
+B5 = '1950Q1';
+
+% Create dates objects.
+dd = dates(B1,B2,B3,B4);
+
+% Check the results.
+t(1) = isequal(dates(B1)>dates(B2),false);
+t(2) = isequal(dates(B2)>dates(B1),true);
+t(3) = isequal(dates(B5)>dates(B1),true);
+t(4) = isequal(dd>dates(B5),false(4,1));
+t(5) = isequal(dates(B5)>dd,true(4,1));
+t(6) = isequal(dates(B1)>dd,false(4,1));
+T = all(t);
 %@eof:2
diff --git a/src/@dates/intersect.m b/src/@dates/intersect.m
index c8328875e6c960533f5e577bc36f7fe1e1eb727b..380f9af0bd337d6b2ea6ad4d7f569758a5c11fd6 100644
--- a/src/@dates/intersect.m
+++ b/src/@dates/intersect.m
@@ -9,7 +9,7 @@ function q = intersect(o, p) % --*-- Unitary tests --*--
 % OUTPUTS
 % - q [dates] All the common elements in o and p.
 
-% Copyright (C) 2013-2020 Dynare Team
+% Copyright © 2013-2020 Dynare Team
 %
 % This code is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -42,9 +42,19 @@ end
 % The problem should be fixed in Octave 6.2.0.
 % See: https://savannah.gnu.org/bugs/?59708
 if isoctave && octave_ver_less_than('6.2')
-    time = intersect(o.time,p.time,'rows');
+    if o.freq==365
+        time = intersect(o.time(:,1), p.time(:,1));
+        time = [time, NaN(length(time), 1)];
+    else
+        time = intersect(o.time,p.time,'rows');
+    end
 else
-    time = intersect(o.time,p.time,'rows','legacy');
+    if o.freq==365
+        time = intersect(o.time(:,1), p.time(:,1), 'legacy');
+        time = [time, NaN(length(time), 1)];
+    else
+        time = intersect(o.time,p.time,'rows','legacy');
+    end
 end
 
 q = dates();
@@ -55,31 +65,46 @@ end
 q.freq = o.freq;
 q.time = time;
 
+return
+
 %@test:1
-%$ % Define some dates objects
-%$ d1 = dates('1950Q1'):dates('1969Q4') ;
-%$ d2 = dates('1960Q1'):dates('1969Q4') ;
-%$ d3 = dates('1970Q1'):dates('1979Q4') ;
-%$
-%$ % Call the tested routine.
-%$ c1 = intersect(d1,d2);
-%$ c2 = intersect(d1,d3);
-%$
-%$ % Check the results.
-%$ t(1) = dassert(c1,d2);
-%$ t(2) = dassert(isempty(c2),true);
-%$ T = all(t);
+% Define some dates objects
+d1 = dates('1950Q1'):dates('1969Q4') ;
+d2 = dates('1960Q1'):dates('1969Q4') ;
+d3 = dates('1970Q1'):dates('1979Q4') ;
+
+% Call the tested routine.
+c1 = intersect(d1,d2);
+c2 = intersect(d1,d3);
+
+% Check the results.
+t(1) = isequal(c1,d2);
+t(2) = isequal(isempty(c2),true);
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ % Define some dates objects
-%$ d1 = dates('1950Q1'):dates('1969Q4') ;
-%$ d2 = dates('1950Q1'):dates('1969Q4') ;
-%$
-%$ % Call the tested routine.
-%$ c1 = intersect(d1,d2);
-%$
-%$ % Check the results.
-%$ t(1) = dassert(c1,d1);
-%$ T = all(t);
+% Define some dates objects
+d1 = dates('1950Q1'):dates('1969Q4') ;
+d2 = dates('1950Q1'):dates('1969Q4') ;
+
+% Call the tested routine.
+c1 = intersect(d1,d2);
+
+% Check the results.
+t(1) = isequal(c1,d1);
+T = all(t);
 %@eof:2
+
+%@test:3
+% Define some dates objects
+d1 = dates('2000-01-01'):dates('2000-01-10');
+d2 = dates('2000-01-05'):dates('2000-01-10');
+
+% Call the tested routine.
+c1 = intersect(d1,d2);
+
+% Check the results.
+t(1) = isequal(c1,d2);
+T = all(t);
+%@eof:3
diff --git a/src/@dates/isequal.m b/src/@dates/isequal.m
index 3922f0356851a7ee3407bccd726e0d80b0b00798..f0d843d0e9c247170d2e94a27e8be3458e3455e5 100644
--- a/src/@dates/isequal.m
+++ b/src/@dates/isequal.m
@@ -1,6 +1,6 @@
 function l = isequal(o, p, fake) % --*-- Unitary tests --*--
 
-% Overloads isequal function for dates objects. Returns true (1) iff o and p have the same elements.
+% Overloads isequal function for dates objects. Returns true true iff o and p have the same elements.
 %
 % INPUTS
 % - o [dates]
@@ -9,7 +9,7 @@ function l = isequal(o, p, fake) % --*-- Unitary tests --*--
 % OUTPUTS
 % - l [logical]
 
-% Copyright (C) 2013-2017 Dynare Team
+% Copyright © 2013-2020 Dynare Team
 %
 % This code is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -28,44 +28,82 @@ if ~isa(o,'dates') || ~isa(p,'dates')
     error('dates:isequal:ArgCheck','Both inputs must be dates objects!')
 end
 
-l = isequal(o.freq, p.freq) && isequal(o.time, p.time);
+if o.freq==365
+    l = isequal(o.freq, p.freq) && isequal(o.time(:,1), p.time(:,1));
+else
+    l = isequal(o.freq, p.freq) && isequal(o.time, p.time);
+end
+
+return
 
 %@test:1
-%$ d1 = dates('1938Q1');
-%$ d2 = dates('1938Q1');
-%$ % Test if this object is empty
-%$ t(1) = isequal(d1,d2);
-%$ T = all(t);
+d1 = dates('1938Q1');
+d2 = dates('1938Q1');
+% Test if this object is empty
+try
+    t(1) = isequal(d1, d2);
+catch
+    t(1) = false;
+end
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ d1 = dates('1938Q1');
-%$ d2 = dates('1938Q2');
-%$ % Test if this object is empty
-%$ t(1) = ~isequal(d1,d2);
-%$ T = all(t);
+d1 = dates('1938Q1');
+d2 = dates('1938Q2');
+% Test if this object is empty
+try
+    t(1) = ~isequal(d1,d2);
+catch
+    t(1) = false;
+end
+T = all(t);
 %@eof:2
 
 %@test:3
-%$ d1 = dates('1938Q4');
-%$ d2 = dates('1938M11');
-%$ % Test if this object is empty
-%$ t(1) = ~isequal(d1,d2);
-%$ T = all(t);
+d1 = dates('1938Q4');
+d2 = dates('1938M11');
+% Test if this object is empty
+try
+    t(1) = ~isequal(d1,d2);
+catch
+    t(1) = false;
+end
+T = all(t);
 %@eof:3
 
 %@test:4
-%$ d1 = dates('1938Q4','1938Q3');
-%$ d2 = dates('1938Q3','1938Q1');
-%$ % Test if this object is empty
-%$ t(1) = ~isequal(d1,d2);
-%$ T = all(t);
+d1 = dates('1938Q4','1938Q3');
+d2 = dates('1938Q3','1938Q1');
+% Test if this object is empty
+try
+    t(1) = ~isequal(d1,d2);
+catch
+    t(1) = false;
+end
+T = all(t);
 %@eof:4
 
 %@test:5
-%$ d1 = dates('1938Q4','1938Q3','1938Q2');
-%$ d2 = dates('1938Q3','1938Q1');
-%$ % Test if this object is empty
-%$ t(1) = ~isequal(d1,d2);
-%$ T = all(t);
+d1 = dates('1938Q4','1938Q3','1938Q2');
+d2 = dates('1938Q3','1938Q1');
+% Test if this object is empty
+try
+    t(1) = ~isequal(d1,d2);
+catch
+    t(1) = false;
+end
+T = all(t);
 %@eof:5
+
+%@test:6
+d1 = dates('1938-11-22');
+d2 = dates('1945-09-01');
+% Test if this object is empty
+try
+    t(1) = ~isequal(d1,d2);
+catch
+    t(1) = false;
+end
+T = all(t);
+%@eof:6
diff --git a/src/@dates/le.m b/src/@dates/le.m
index 5c36a1cba6251ec3dba33e3c25d230759deec6eb..2c32dce00bb491b4ff266849849880e0e0c40b72 100644
--- a/src/@dates/le.m
+++ b/src/@dates/le.m
@@ -3,13 +3,13 @@ function l = le(varargin)  % --*-- Unitary tests --*--
 % Overloads the <= operator for dates objects.
 %
 % INPUTS
-% - o [dates] dates object with n or 1 elements.
-% - p [dates] dates object with n or 1 elements.
+% - o [dates]   object with n or 1 elements.
+% - p [dates]   object with n or 1 elements.
 %
 % OUTPUTS
 % - l [logical] column vector of max(n,1) elements (zeros or ones).
 
-% Copyright (C) 2013-2017 Dynare Team
+% Copyright © 2013-2020 Dynare Team
 %
 % This code is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -26,6 +26,11 @@ function l = le(varargin)  % --*-- Unitary tests --*--
 
 [o, p] = comparison_arg_checks(varargin{:});
 
+if o.freq==365
+    l = o.time(:,1)<=p.time(:,1);
+    return
+end
+
 if isequal(o.ndat(), p.ndat())
     l = (o==p);
     idx = find(l==0);
@@ -46,50 +51,52 @@ else
     end
 end
 
+return
+
 %@test:1
-%$ % Define some dates
-%$ date_2 = '1950Q2';
-%$ date_3 = '1950Q3';
-%$ date_4 = '1950Q1';
-%$ date_5 = '1949Q2';
-%$
-%$ % Call the tested routine.
-%$ d2 = dates(date_2);
-%$ d3 = dates(date_3);
-%$ d4 = dates(date_4);
-%$ d5 = dates(date_5);
-%$ i1 = (d2<=d3);
-%$ i2 = (d3<=d4);
-%$ i3 = (d4<=d2);
-%$ i4 = (d5<=d4);
-%$ i5 = (d5<=d5);
-%$
-%$ % Check the results.
-%$ t(1) = dassert(i1,true);
-%$ t(2) = dassert(i2,false);
-%$ t(3) = dassert(i3,true);
-%$ t(4) = dassert(i4,true);
-%$ t(5) = dassert(i5,true);
-%$ T = all(t);
+% Define some dates
+date_2 = '1950Q2';
+date_3 = '1950Q3';
+date_4 = '1950Q1';
+date_5 = '1949Q2';
+
+% Call the tested routine.
+d2 = dates(date_2);
+d3 = dates(date_3);
+d4 = dates(date_4);
+d5 = dates(date_5);
+i1 = (d2<=d3);
+i2 = (d3<=d4);
+i3 = (d4<=d2);
+i4 = (d5<=d4);
+i5 = (d5<=d5);
+
+% Check the results.
+t(1) = isequal(i1,true);
+t(2) = isequal(i2,false);
+t(3) = isequal(i3,true);
+t(4) = isequal(i4,true);
+t(5) = isequal(i5,true);
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ % Define some dates
-%$ B1 = '1945Q1';
-%$ B2 = '1945Q2';
-%$ B3 = '1945Q3';
-%$ B4 = '1945Q4';
-%$ B5 = '1950Q1';
-%$
-%$ % Create dates objects.
-%$ dd = dates(B1,B2,B3,B4);
-%$
-%$ % Check the results.
-%$ t(1) = dassert(dates(B1)<=dates(B2),true);
-%$ t(2) = dassert(dates(B2)<=dates(B1),false);
-%$ t(3) = dassert(dates(B2)<=dates(B2),true);
-%$ t(4) = dassert(dd<=dates(B5),true(4,1));
-%$ t(5) = dassert(dates(B5)<=dd,false(4,1));
-%$ t(6) = dassert(dates(B1)<=dd,true(4,1));
-%$ T = all(t);
+% Define some dates
+B1 = '1945Q1';
+B2 = '1945Q2';
+B3 = '1945Q3';
+B4 = '1945Q4';
+B5 = '1950Q1';
+
+% Create dates objects.
+dd = dates(B1,B2,B3,B4);
+
+% Check the results.
+t(1) = isequal(dates(B1)<=dates(B2),true);
+t(2) = isequal(dates(B2)<=dates(B1),false);
+t(3) = isequal(dates(B2)<=dates(B2),true);
+t(4) = isequal(dd<=dates(B5),true(4,1));
+t(5) = isequal(dates(B5)<=dd,false(4,1));
+t(6) = isequal(dates(B1)<=dd,true(4,1));
+T = all(t);
 %@eof:2
diff --git a/src/@dates/lt.m b/src/@dates/lt.m
index 826b3afcb1b9927a63d2cfcf500ffa7b19d1901d..4ed189b83b6569510b6f905c242bef5b5d753bfb 100644
--- a/src/@dates/lt.m
+++ b/src/@dates/lt.m
@@ -3,13 +3,13 @@ function l = lt(varargin)  % --*-- Unitary tests --*--
 % Overloads the < operator for dates objects.
 %
 % INPUTS
-% - o [dates] dates object with n or 1 elements.
-% - p [dates] dates object with n or 1 elements.
+% - o [dates]   object with n or 1 elements.
+% - p [dates]   object with n or 1 elements.
 %
 % OUTPUTS
 % - l [logical] column vector of max(n,1) elements (zeros or ones).
 
-% Copyright (C) 2013-2017 Dynare Team
+% Copyright © 2013-2020 Dynare Team
 %
 % This code is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -26,6 +26,11 @@ function l = lt(varargin)  % --*-- Unitary tests --*--
 
 [o, p] = comparison_arg_checks(varargin{:});
 
+if o.freq==365
+    l = o.time(:,1)<p.time(:,1);
+    return
+end
+
 if isequal(o.ndat(), p.ndat())
     l = false(o.ndat(),1);
     for i=1:o.ndat()
@@ -45,48 +50,50 @@ else
     end
 end
 
+return
+
 %@test:1
-%$ % Define some dates
-%$ date_2 = '1950Q2';
-%$ date_3 = '1950Q3';
-%$ date_4 = '1950Q1';
-%$ date_5 = '1949Q2';
-%$
-%$ % Call the tested routine.
-%$ d2 = dates(date_2);
-%$ d3 = dates(date_3);
-%$ d4 = dates(date_4);
-%$ d5 = dates(date_5);
-%$ i1 = (d2<d3);
-%$ i2 = (d3<d4);
-%$ i3 = (d4<d2);
-%$ i4 = (d5<d4);
-%$
-%$ % Check the results.
-%$ t(1) = dassert(i1,true);
-%$ t(2) = dassert(i2,false);
-%$ t(3) = dassert(i3,true);
-%$ t(4) = dassert(i4,true);
-%$ T = all(t);
+% Define some dates
+date_2 = '1950Q2';
+date_3 = '1950Q3';
+date_4 = '1950Q1';
+date_5 = '1949Q2';
+
+% Call the tested routine.
+d2 = dates(date_2);
+d3 = dates(date_3);
+d4 = dates(date_4);
+d5 = dates(date_5);
+i1 = (d2<d3);
+i2 = (d3<d4);
+i3 = (d4<d2);
+i4 = (d5<d4);
+
+% Check the results.
+t(1) = isequal(i1,true);
+t(2) = isequal(i2,false);
+t(3) = isequal(i3,true);
+t(4) = isequal(i4,true);
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ % Define some dates
-%$ B1 = '1945Q1';
-%$ B2 = '1945Q2';
-%$ B3 = '1945Q3';
-%$ B4 = '1945Q4';
-%$ B5 = '1950Q1';
-%$
-%$ % Create dates objects.
-%$ dd = dates(B1,B2,B3,B4);
-%$
-%$ % Check the results.
-%$ t(1) = dassert(dates(B1)<dates(B2),true);
-%$ t(2) = dassert(dates(B2)<dates(B1),false);
-%$ t(3) = dassert(dates(B2)<dates(B1),false);
-%$ t(4) = dassert(dd<dates(B5),true(4,1));
-%$ t(5) = dassert(dates(B5)<dd,false(4,1));
-%$ t(6) = dassert(dates(B1)<dd,[false; true(3,1)]);
-%$ T = all(t);
+% Define some dates
+B1 = '1945Q1';
+B2 = '1945Q2';
+B3 = '1945Q3';
+B4 = '1945Q4';
+B5 = '1950Q1';
+
+% Create dates objects.
+dd = dates(B1,B2,B3,B4);
+
+% Check the results.
+t(1) = isequal(dates(B1)<dates(B2),true);
+t(2) = isequal(dates(B2)<dates(B1),false);
+t(3) = isequal(dates(B2)<dates(B1),false);
+t(4) = isequal(dd<dates(B5),true(4,1));
+t(5) = isequal(dates(B5)<dd,false(4,1));
+t(6) = isequal(dates(B1)<dd,[false; true(3,1)]);
+T = all(t);
 %@eof:2
diff --git a/src/@dates/max.m b/src/@dates/max.m
index 10bdec6c3a881f8ff5e46c7c6faa0340d80afc4a..af0466f505ab949a7cfa9cd6a4160740d2be8c70 100644
--- a/src/@dates/max.m
+++ b/src/@dates/max.m
@@ -6,9 +6,9 @@ function q = max(varargin)  % --*-- Unitary tests --*--
 % - varargin [dates]
 %
 % OUTPUTS
-% - q [dates]
+% - q        [dates]
 
-% Copyright (C) 2013-2017 Dynare Team
+% Copyright © 2013-2020 Dynare Team
 %
 % This code is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -29,58 +29,83 @@ end
 
 switch nargin
   case 1
-    sorted_time_member = sortrows(varargin{1}.time);
+    if varargin{1}.freq==365
+        sorted_time_member = sort(varargin{1}.time(:,1));
+    else
+        sorted_time_member = sortrows(varargin{1}.time);
+    end
     q = dates();
     q.freq = varargin{1}.freq;
-    q.time = sorted_time_member(varargin{1}.ndat(),:);
+    if varargin{1}.freq==365
+        q.time = [sorted_time_member(varargin{1}.ndat()), NaN];
+    else
+        q.time = sorted_time_member(varargin{1}.ndat(),:);
+    end
   otherwise
     q = max(horzcat(varargin{:}));
 end
 
+return
+
 %@test:1
-%$ % Define some dates
-%$ d3 = dates('1950q2');
-%$ d4 = dates('1950Q3');
-%$ d5 = dates('1950m1');
-%$ d6 = dates('1948M6');
-%$ m2 = max(d3,d4);
-%$ i2 = (m2==d4);
-%$ m3 = max(d5,d6);
-%$ i3 = (m3==d5);
-%$
-%$ % Check the results.
-%$ t(1) = dassert(i2,true);
-%$ t(2) = dassert(i3,true);
-%$ T = all(t);
+% Define some dates
+d3 = dates('1950q2');
+d4 = dates('1950Q3');
+d5 = dates('1950m1');
+d6 = dates('1948M6');
+m2 = max(d3,d4);
+i2 = (m2==d4);
+m3 = max(d5,d6);
+i3 = (m3==d5);
+
+% Check the results.
+t(1) = dassert(i2,true);
+t(2) = dassert(i3,true);
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ % Define some dates
-%$ d = dates('1950Q2','1951Q3','1949Q1','1950Q4');
-%$ m = max(d);
-%$ i = (m==dates('1951Q3'));
-%$
-%$ % Check the results.
-%$ t(1) = dassert(i,true);
-%$ T = all(t);
+% Define some dates
+d = dates('1950Q2','1951Q3','1949Q1','1950Q4');
+m = max(d);
+i = (m==dates('1951Q3'));
+
+% Check the results.
+t(1) = dassert(i,true);
+T = all(t);
 %@eof:2
 
 %@test:3
-%$ % Define some dates
-%$ m = max(dates('1950Q2','1951Q3'),dates('1949Q1'),dates('1950Q4'));
-%$ i = (m==dates('1951Q3'));
-%$
-%$ % Check the results.
-%$ t(1) = dassert(i,true);
-%$ T = all(t);
+% Define some dates
+m = max(dates('1950Q2','1951Q3'),dates('1949Q1'),dates('1950Q4'));
+i = (m==dates('1951Q3'));
+
+% Check the results.
+t(1) = dassert(i,true);
+T = all(t);
 %@eof:3
 
 %@test:4
-%$ % Define some dates
-%$ m = max(dates('1950Q2'),dates('1951Q3'),dates('1949Q1'),dates('1950Q4'));
-%$ i = (m==dates('1951Q3'));
-%$
-%$ % Check the results.
-%$ t(1) = dassert(i,true);
-%$ T = all(t);
+% Define some dates
+m = max(dates('1950Q2'),dates('1951Q3'),dates('1949Q1'),dates('1950Q4'));
+i = (m==dates('1951Q3'));
+
+% Check the results.
+t(1) = dassert(i,true);
+T = all(t);
 %@eof:4
+
+%@test:5
+try
+    M = max(dates('2009-04-12', '1966-11-02'), dates('1938-11-22'), dates('1972-01-25', '1976-03-13'));
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    t(2) = M==dates('2009-04-12');
+end
+
+T = all(t);
+%@eof:5
diff --git a/src/@dates/min.m b/src/@dates/min.m
index 0535179c6c035ccda497e1639b849e41c2a63427..43152af9f44c237e0df522508f56edb3c5ed6317 100644
--- a/src/@dates/min.m
+++ b/src/@dates/min.m
@@ -6,9 +6,9 @@ function q = min(varargin) % --*-- Unitary tests --*--
 % - varargin [dates]
 %
 % OUTPUTS
-% - q [dates]
+% - q        [dates]
 
-% Copyright (C) 2013-2017 Dynare Team
+% Copyright © 2013-2020 Dynare Team
 %
 % This code is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -29,58 +29,83 @@ end
 
 switch nargin
   case 1
-    sorted_time_member = sortrows(varargin{1}.time);
+    if varargin{1}.freq==365
+        sorted_time_member = sort(varargin{1}.time(:,1));
+    else
+        sorted_time_member = sortrows(varargin{1}.time);
+    end
     q = dates();
     q.freq = varargin{1}.freq;
-    q.time = sorted_time_member(1,:);
+    if varargin{1}.freq==365
+        q.time = [sorted_time_member(1,:), NaN];
+    else
+        q.time = sorted_time_member(1,:);
+    end
   otherwise
     q = min(horzcat(varargin{:}));
 end
 
+return
+
 %@test:1
-%$ % Define some dates
-%$ d3 = dates('1950q2');
-%$ d4 = dates('1950Q3');
-%$ d5 = dates('1950m1');
-%$ d6 = dates('1948M6');
-%$ m2 = min(d3,d4);
-%$ i2 = (m2==d3);
-%$ m3 = min(d5,d6);
-%$ i3 = (m3==d6);
-%$
-%$ % Check the results.
-%$ t(1) = dassert(i2,true);
-%$ t(2) = dassert(i3,true);
-%$ T = all(t);
+% Define some dates
+d3 = dates('1950q2');
+d4 = dates('1950Q3');
+d5 = dates('1950m1');
+d6 = dates('1948M6');
+m2 = min(d3,d4);
+i2 = (m2==d3);
+m3 = min(d5,d6);
+i3 = (m3==d6);
+
+% Check the results.
+t(1) = dassert(i2,true);
+t(2) = dassert(i3,true);
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ % Define some dates
-%$ d = dates('1950Q2','1951Q3','1949Q1','1950Q4');
-%$ m = min(d);
-%$ i = (m==dates('1949Q1'));
-%$
-%$ % Check the results.
-%$ t(1) = dassert(i,true);
-%$ T = all(t);
+% Define some dates
+d = dates('1950Q2','1951Q3','1949Q1','1950Q4');
+m = min(d);
+i = (m==dates('1949Q1'));
+
+% Check the results.
+t(1) = dassert(i,true);
+T = all(t);
 %@eof:2
 
 %@test:3
-%$ % Define some dates
-%$ m = min(dates('1950Q2','1951Q3'),dates('1949Q1'),dates('1950Q4'));
-%$ i = (m==dates('1949Q1'));
-%$
-%$ % Check the results.
-%$ t(1) = dassert(i,true);
-%$ T = all(t);
+% Define some dates
+m = min(dates('1950Q2','1951Q3'),dates('1949Q1'),dates('1950Q4'));
+i = (m==dates('1949Q1'));
+
+% Check the results.
+t(1) = dassert(i,true);
+T = all(t);
 %@eof:3
 
 %@test:4
-%$ % Define some dates
-%$ m = min(dates('1950Q2'),dates('1951Q3'),dates('1949Q1'),dates('1950Q4'));
-%$ i = (m==dates('1949Q1'));
-%$
-%$ % Check the results.
-%$ t(1) = dassert(i,true);
-%$ T = all(t);
+% Define some dates
+m = min(dates('1950Q2'),dates('1951Q3'),dates('1949Q1'),dates('1950Q4'));
+i = (m==dates('1949Q1'));
+
+% Check the results.
+t(1) = dassert(i,true);
+T = all(t);
 %@eof:4
+
+%@test:5
+try
+    m = min(dates('2009-04-12', '1966-11-02'), dates('1938-11-22'), dates('1972-01-25', '1976-03-13'));
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    t(2) = m==dates('1938-11-22');
+end
+
+T = all(t);
+%@eof:5
diff --git a/src/@dates/minus.m b/src/@dates/minus.m
index 20f21a45a23a8e6a72723b454324aade125a9ab5..822479d2bdf8f597723d07582aaa64c56c0a616b 100644
--- a/src/@dates/minus.m
+++ b/src/@dates/minus.m
@@ -7,7 +7,7 @@ function q = minus(o,p) % --*-- Unitary tests --*--
 %
 % INPUTS
 % - o [dates]
-% - p [dates or integer]
+% - p [dates,integer]
 %
 % OUTPUTS
 % - q [dates]
@@ -18,7 +18,7 @@ function q = minus(o,p) % --*-- Unitary tests --*--
 %    p periods backward.
 % 3. If o is not a dates object, an error is returned.
 
-% Copyright (C) 2013-2017 Dynare Team
+% Copyright © 2013-2020 Dynare Team
 %
 % This code is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -54,7 +54,11 @@ if isa(o,'dates') && isa(p,'dates')
     q = zeros(u.length(),1);
     id = find(~(u==v));
     if ~isempty(id)
-        q(id) = u.time(id,2)-v.time(id,2) + (u.time(id,1)-v.time(id,1))*v.freq;
+        if o.freq==365
+            q(id) = u.time(id,1)-v.time(id,1);
+        else
+            q(id) = u.time(id,2)-v.time(id,2) + (u.time(id,1)-v.time(id,1))*v.freq;
+        end
     end
 elseif isa(o,'dates') && ~isa(p,'dates')
     if (isvector(p) && isequal(length(p),o.ndat()) && all(isint(p))) || (isscalar(p) && isint(p)) || (isequal(o.length(),1) && isvector(p) && all(isint(p)))
@@ -68,102 +72,140 @@ else
     error('dates:minus:ArgCheck','You should read the manual.')
 end
 
+return
+
 %@test:1
-%$ % Define some dates objects
-%$ d1 = dates('1950Q1','1950Q2','1960Q1');
-%$ d2 = dates('1950Q3','1950Q4','1960Q1');
-%$ d3 = dates('2000Q1');
-%$ d4 = dates('2002Q2');
-%$ % Call the tested routine.
-%$ try
-%$   e1 = d2-d1;
-%$   e2 = d4-d3;
-%$   t(1) = 1;
-%$ catch
-%$   t(1) = 0;
-%$ end
-%$
-%$ if t(1)
-%$   t(2) = dassert(e1,[2; 2; 0]);
-%$   t(3) = dassert(e2,9);
-%$ end
-%$ T = all(t);
+% Define some dates objects
+d1 = dates('1950Q1','1950Q2','1960Q1');
+d2 = dates('1950Q3','1950Q4','1960Q1');
+d3 = dates('2000Q1');
+d4 = dates('2002Q2');
+% Call the tested routine.
+try
+  e1 = d2-d1;
+  e2 = d4-d3;
+  t(1) = true;
+catch
+  t(1) = false;
+end
+
+if t(1)
+  t(2) = isequal(e1,[2; 2; 0]);
+  t(3) = isequal(e2,9);
+end
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ % Define some dates objects
-%$ d1 = dates('1950Y','1951Y','1953Y');
-%$ d2 = dates('1951Y','1952Y','1953Y');
-%$ d3 = dates('2000Y');
-%$ d4 = dates('1999Y');
-%$ % Call the tested routine.
-%$ try
-%$   e1 = d2-d1;
-%$   e2 = d4-d3;
-%$   t(1) = 1;
-%$ catch
-%$   t(1) = 0;
-%$ end
-%$
-%$ if t(1)
-%$   t(2) = dassert(e1,[1; 1; 0]);
-%$   t(3) = dassert(e2,-1);
-%$ end
-%$ T = all(t);
+% Define some dates objects
+d1 = dates('1950Y','1951Y','1953Y');
+d2 = dates('1951Y','1952Y','1953Y');
+d3 = dates('2000Y');
+d4 = dates('1999Y');
+% Call the tested routine.
+try
+  e1 = d2-d1;
+  e2 = d4-d3;
+  t(1) = true;
+catch
+  t(1) = false;
+end
+
+if t(1)
+  t(2) = isequal(e1,[1; 1; 0]);
+  t(3) = isequal(e2,-1);
+end
+T = all(t);
 %@eof:2
 
 %@test:3
-%$ % Define some dates objects
-%$ d1 = dates('2000Y');
-%$ d2 = dates('1999Y');
-%$ % Call the tested routine.
-%$ try
-%$   e1 = d1-1;
-%$   e2 = d2-(-1);
-%$   t(1) = 1;
-%$ catch
-%$   t(1) = 0;
-%$ end
-%$
-%$ if t(1)
-%$   t(2) = dassert(e1,d2);
-%$   t(3) = dassert(e2,d1);
-%$ end
-%$ T = all(t);
+% Define some dates objects
+d1 = dates('2000Y');
+d2 = dates('1999Y');
+% Call the tested routine.
+try
+  e1 = d1-1;
+  e2 = d2-(-1);
+  t(1) = true;
+catch
+  t(1) = false;
+end
+
+if t(1)
+  t(2) = isequal(e1,d2);
+  t(3) = isequal(e2,d1);
+end
+T = all(t);
 %@eof:3
 
 %@test:4
-%$ % Define some dates objects
-%$ d1 = dates('2000Q1');
-%$ e1 = dates('1999Q4','1999Q3','1999Q2','1999Q1','1998Q4');
-%$ % Call the tested routine.
-%$ try
-%$   f1 = d1-transpose(1:5);
-%$   t(1) = 1;
-%$ catch
-%$   t(1) = 0;
-%$ end
-%$
-%$ if t(1)
-%$   t(2) = dassert(e1,f1);
-%$ end
-%$ T = all(t);
+% Define some dates objects
+d1 = dates('2000Q1');
+e1 = dates('1999Q4','1999Q3','1999Q2','1999Q1','1998Q4');
+% Call the tested routine.
+try
+  f1 = d1-transpose(1:5);
+  t(1) = true;
+catch
+  t(1) = false;
+end
+
+if t(1)
+  t(2) = isequal(e1,f1);
+end
+T = all(t);
 %@eof:4
 
 %@test:5
-%$ % Define some dates objects
-%$ d1 = dates('1999Q4','1999Q3','1999Q2','1999Q1','1998Q4');
-%$ e1 = dates('2000Q1')*5;
-%$ % Call the tested routine.
-%$ try
-%$   f1 = d1-(-transpose(1:5));
-%$   t(1) = 1;
-%$ catch
-%$   t(1) = 0;
-%$ end
-%$
-%$ if t(1)
-%$   t(2) = dassert(e1,f1);
-%$ end
-%$ T = all(t);
+% Define some dates objects
+d1 = dates('1999Q4','1999Q3','1999Q2','1999Q1','1998Q4');
+e1 = dates('2000Q1')*5;
+% Call the tested routine.
+try
+  f1 = d1-(-transpose(1:5));
+  t(1) = true;
+catch
+  t(1) = false;
+end
+
+if t(1)
+  t(2) = isequal(e1,f1);
+end
+T = all(t);
 %@eof:5
+
+%@test:6
+% Define some dates objects
+d1 = dates('2020-01-02');
+d2 = dates('2020-01-01','2019-12-31');
+% Call the tested routine.
+try
+  delta = d1-d2;
+  t(1) = true;
+catch
+  t(1) = false;
+end
+
+if t(1)
+  t(2) = isequal([1;2], delta);
+end
+T = all(t);
+%@eof:6
+
+%@test:7
+% Define some dates objects
+d1 = dates('2000-03-02');
+e2 = [1; 2];
+% Call the tested routine.
+try
+  d2 = d1-e2;
+  t(1) = true;
+catch
+  t(1) = false;
+end
+
+if t(1)
+  t(2) = isequal(dates('2000-03-01', '2000-02-29'), d2);
+end
+T = all(t);
+%@eof:7
diff --git a/src/@dates/ndat.m b/src/@dates/ndat.m
index e29310fb1e449b8b9becfbed4d8015fac129d56c..7b8fb41a067db1c1e0f7ec9cee0794edb6771469 100644
--- a/src/@dates/ndat.m
+++ b/src/@dates/ndat.m
@@ -8,7 +8,7 @@ function s = ndat(o) % --*-- Unitary tests --*--
 % OUTPUTS
 % - s  [integer]
 
-% Copyright (C) 2015-2017 Dynare Team
+% Copyright © 2015-2020 Dynare Team
 %
 % This code is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -25,74 +25,58 @@ function s = ndat(o) % --*-- Unitary tests --*--
 
 s = size(o.time, 1);
 
+return
+
 %@test:1
-%$ % Define a dates object
-%$ o = dates('1950Q1'):dates('1952Q1');
-%$
-%$ % Call the tested routine.
-%$ try
-%$     card = ndat(o);
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ if t(1)
-%$     t(2) = dassert(card,9);
-%$ end
-%$ T = all(t);
+% Define a dates object
+o = dates('1950Q1'):dates('1952Q1');
+
+% Call the tested routine.
+try
+    card = ndat(o);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    t(2) = dassert(card,9);
+end
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ % Define a dates object
-%$ o = dates('1950M1'):dates('1951M6');
-%$
-%$ % Call the tested routine.
-%$ try
-%$     card = ndat(o);
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ if t(1)
-%$     t(2) = dassert(card,18);
-%$ end
-%$ T = all(t);
+% Define a dates object
+o = dates('1950M1'):dates('1951M6');
+
+% Call the tested routine.
+try
+    card = ndat(o);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    t(2) = dassert(card,18);
+end
+T = all(t);
 %@eof:2
 
 %@test:3
-%$ % Define a dates object
-%$ o = dates('1950W1'):dates('1950W16');
-%$
-%$ % Call the tested routine.
-%$ try
-%$     card = ndat(o);
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ if t(1)
-%$     t(2) = dassert(card,16);
-%$ end
-%$ T = all(t);
-%@eof:3
+% Define a dates object
+o = dates('1950Y'):dates('1959Y');
+
+% Call the tested routine.
+try
+    card = ndat(o);
+    t(1) = true;
+catch
+    t(1) = false;
+end
 
-%@test:4
-%$ % Define a dates object
-%$ o = dates('1950Y'):dates('1959Y');
-%$
-%$ % Call the tested routine.
-%$ try
-%$     card = ndat(o);
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ if t(1)
-%$     t(2) = dassert(card,10);
-%$ end
-%$ T = all(t);
-%@eof:4
+if t(1)
+    t(2) = dassert(card,10);
+end
+T = all(t);
+%@eof:3
\ No newline at end of file
diff --git a/src/@dates/ne.m b/src/@dates/ne.m
index 351166ec473cc77e676cd67842a69802fc409b3e..13760472a4344e651c8f64495d266b0c40d632b0 100644
--- a/src/@dates/ne.m
+++ b/src/@dates/ne.m
@@ -3,13 +3,13 @@ function l = ne(varargin) % --*-- Unitary tests --*--
 % Overloads ~= operator for dates objects.
 %
 % INPUTS
-% - o [dates] dates object with n or 1 elements.
-% - p [dates] dates object with n or 1 elements.
+% - o [dates]   object with n or 1 elements.
+% - p [dates]   object with n or 1 elements.
 %
 % OUTPUTS
 % - l [logical] column vector of max(n,1) elements (zeros or ones).
 
-% Copyright (C) 2013-2015 Dynare Team
+% Copyright © 2013-2020 Dynare Team
 %
 % This code is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -26,60 +26,67 @@ function l = ne(varargin) % --*-- Unitary tests --*--
 
 [o, p] = comparison_arg_checks(varargin{:});
 
+if o.freq==365
+    l = o.time(:,1)~=p.time(:,1);
+    return
+end
+
 if isequal(o.ndat(), p.ndat())
     l = logical(transpose(any(transpose(ne(o.time,p.time)))));
 else
     l = logical(transpose(any(transpose(bsxfun(@ne,o.time,p.time)))));
 end
 
+return
+
 %@test:1
-%$ % Define some dates objects
-%$ d1 = dates('1950Q1','1950Q2','1950Q3','1950Q4') ;
-%$ d2 = dates('1960Q1','1960Q2','1960Q3','1960Q4') ;
-%$ d3 = dates('1950Q1','1960Q2','1950Q3','1960Q4') ;
-%$
-%$ % Call the tested routine.
-%$ t1 = d1~=d1;
-%$ t2 = d1~=d2;
-%$ t3 = d1~=d3;
-%$
-%$ % Check the results.
-%$ t(1) = dassert(t1,false(4,1));
-%$ t(2) = dassert(t2,true(4,1));
-%$ t(3) = dassert(t3,[false; true; false; true]);
-%$ T = all(t);
+% Define some dates objects
+d1 = dates('1950Q1','1950Q2','1950Q3','1950Q4') ;
+d2 = dates('1960Q1','1960Q2','1960Q3','1960Q4') ;
+d3 = dates('1950Q1','1960Q2','1950Q3','1960Q4') ;
+
+% Call the tested routine.
+t1 = d1~=d1;
+t2 = d1~=d2;
+t3 = d1~=d3;
+
+% Check the results.
+t(1) = isequal(t1,false(4,1));
+t(2) = isequal(t2,true(4,1));
+t(3) = isequal(t3,[false; true; false; true]);
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ % Define some dates objects
-%$ d1 = dates('1950Q1') ;
-%$ d2 = dates('1960Q1') ;
-%$ d3 = dates('1960Q1') ;
-%$
-%$ % Call the tested routine.
-%$ t1 = d1~=d1;
-%$ t2 = d1~=d2;
-%$ t3 = d1~=d3;
-%$
-%$ % Check the results.
-%$ t(1) = dassert(t1,false);
-%$ t(2) = dassert(t2,true);
-%$ t(3) = dassert(t3,true);
-%$ T = all(t);
+% Define some dates objects
+d1 = dates('1950Q1') ;
+d2 = dates('1960Q1') ;
+d3 = dates('1960Q1') ;
+
+% Call the tested routine.
+t1 = d1~=d1;
+t2 = d1~=d2;
+t3 = d1~=d3;
+
+% Check the results.
+t(1) = isequal(t1,false);
+t(2) = isequal(t2,true);
+t(3) = isequal(t3,true);
+T = all(t);
 %@eof:2
 
 %@test:3
-%$ % Define some dates objects
-%$ d1 = dates('1950Q1','1950Q2','1950Q3','1950Q4') ;
-%$ d2 = dates('1950Q2') ;
-%$ d3 = dates('1970Q1') ;
-%$
-%$ % Call the tested routine.
-%$ t1 = d1~=d2;
-%$ t2 = d1~=d3;
-%$
-%$ % Check the results.
-%$ t(1) = dassert(t1,[true; false; true; true]);
-%$ t(2) = dassert(t2,true(4,1));
-%$ T = all(t);
+% Define some dates objects
+d1 = dates('1950Q1','1950Q2','1950Q3','1950Q4') ;
+d2 = dates('1950Q2') ;
+d3 = dates('1970Q1') ;
+
+% Call the tested routine.
+t1 = d1~=d2;
+t2 = d1~=d3;
+
+% Check the results.
+t(1) = isequal(t1,[true; false; true; true]);
+t(2) = isequal(t2,true(4,1));
+T = all(t);
 %@eof:3
diff --git a/src/@dates/plus.m b/src/@dates/plus.m
index 281045af30a679102ad8fa39043007befe2997e0..e6a52b1afaa2ad98c585bdabb3fabfb2d206eb10 100644
--- a/src/@dates/plus.m
+++ b/src/@dates/plus.m
@@ -1,10 +1,10 @@
-function q = plus(o,p) % --*-- Unitary tests --*--
+function q = plus(o, p) % --*-- Unitary tests --*--
 
 % Overloads the plus (+) binary operator.
 %
 % INPUTS
-% - o [dates or integer]
-% - p [dates or integer]
+% - o [dates,integer]
+% - p [dates,integer]
 %
 % OUTPUTS
 % - q [dates]
@@ -14,7 +14,7 @@ function q = plus(o,p) % --*-- Unitary tests --*--
 % 2. If  one of the inputs is an integer or a vector of integers, the method shifts the dates
 %    object by X (the interger input) periods forward.
 
-% Copyright (C) 2013-2017 Dynare Team
+% Copyright © 2013-2020 Dynare Team
 %
 % This code is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ function q = plus(o,p) % --*-- Unitary tests --*--
 
 if isa(o,'dates') && isa(p,'dates')
     % Concatenate dates objects without removing repetitions if o and p are not disjoint sets of dates.
-    if ~isequal(o.freq,p.freq)
+    if ~isequal(o.freq, p.freq)
         error('dates:plus:ArgCheck','Input arguments must have common frequency!')
     end
     if isempty(p)
@@ -65,86 +65,113 @@ else
     error('dates:plus:ArgCheck','Please read the manual.')
 end
 
+return
+
 %@test:1
-%$ % Define some dates objects
-%$ d1 = dates('1950Q1','1950Q2') ;
-%$ d2 = dates('1950Q3','1950Q4') ;
-%$ d3 = dates('1950Q1','1950Q2','1950Q3','1950Q4') ;
-%$
-%$ % Call the tested routine.
-%$ try
-%$   e1 = d1+d2;
-%$   e2 = d1+d2+d3;
-%$   t(1) = 1;
-%$ catch
-%$   t(1) = 0;
-%$ end
-%$
-%$ if t(1)
-%$   t(2) = dassert(e1,d3);
-%$   t(3) = dassert(e2,dates('1950Q1','1950Q2','1950Q3','1950Q4','1950Q1','1950Q2','1950Q3','1950Q4'));
-%$ end
-%$ T = all(t);
+% Define some dates objects
+d1 = dates('1950Q1','1950Q2') ;
+d2 = dates('1950Q3','1950Q4') ;
+d3 = dates('1950Q1','1950Q2','1950Q3','1950Q4') ;
+
+% Call the tested routine.
+try
+  e1 = d1+d2;
+  e2 = d1+d2+d3;
+  t(1) = 1;
+catch
+  t(1) = 0;
+end
+
+if t(1)
+  t(2) = dassert(e1,d3);
+  t(3) = dassert(e2,dates('1950Q1','1950Q2','1950Q3','1950Q4','1950Q1','1950Q2','1950Q3','1950Q4'));
+end
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ % Define some dates objects
-%$ d1 = dates('1950Q1');
-%$ e1 = dates('1950Q2');
-%$ e2 = dates('1950Q3');
-%$ e3 = dates('1950Q4');
-%$ e4 = dates('1951Q1');
-%$ e5 = dates('1950Q2','1950Q3','1950Q4','1951Q1');
-%$
-%$ % Call the tested routine.
-%$ try
-%$   f1 = d1+1;
-%$   f2 = d1+2;
-%$   f3 = d1+3;
-%$   f4 = d1+4;
-%$   f5 = d1+transpose(1:4);
-%$   t(1) = 1;
-%$ catch
-%$   t(1) = 0;
-%$ end
-%$
-%$ if t(1)
-%$   t(2) = dassert(e1,f1);
-%$   t(3) = dassert(e2,f2);
-%$   t(4) = dassert(e3,f3);
-%$   t(5) = dassert(e4,f4);
-%$   t(6) = dassert(e5,f5);
-%$ end
-%$ T = all(t);
+% Define some dates objects
+d1 = dates('1950Q1');
+e1 = dates('1950Q2');
+e2 = dates('1950Q3');
+e3 = dates('1950Q4');
+e4 = dates('1951Q1');
+e5 = dates('1950Q2','1950Q3','1950Q4','1951Q1');
+
+% Call the tested routine.
+try
+  f1 = d1+1;
+  f2 = d1+2;
+  f3 = d1+3;
+  f4 = d1+4;
+  f5 = d1+transpose(1:4);
+  t(1) = 1;
+catch
+  t(1) = 0;
+end
+
+if t(1)
+  t(2) = dassert(e1,f1);
+  t(3) = dassert(e2,f2);
+  t(4) = dassert(e3,f3);
+  t(5) = dassert(e4,f4);
+  t(6) = dassert(e5,f5);
+end
+T = all(t);
 %@eof:2
 
 %@test:3
-%$ % Define some dates objects
-%$ d1 = dates('1950Q1');
-%$ e1 = dates('1949Q4');
-%$ e2 = dates('1949Q3');
-%$ e3 = dates('1949Q2');
-%$ e4 = dates('1949Q1');
-%$ e5 = dates('1948Q4');
-%$
-%$ % Call the tested routine.
-%$ try
-%$   f1 = d1+(-1);
-%$   f2 = d1+(-2);
-%$   f3 = d1+(-3);
-%$   f4 = d1+(-4);
-%$   f5 = d1+(-5);
-%$   t(1) = 1;
-%$ catch
-%$   t(1) = 0;
-%$ end
-%$
-%$ if t(1)
-%$   t(2) = dassert(e1,f1);
-%$   t(3) = dassert(e2,f2);
-%$   t(4) = dassert(e3,f3);
-%$   t(5) = dassert(e4,f4);
-%$   t(6) = dassert(e5,f5);
-%$ end
-%$ T = all(t);
+% Define some dates objects
+d1 = dates('1950Q1');
+e1 = dates('1949Q4');
+e2 = dates('1949Q3');
+e3 = dates('1949Q2');
+e4 = dates('1949Q1');
+e5 = dates('1948Q4');
+
+% Call the tested routine.
+try
+  f1 = d1+(-1);
+  f2 = d1+(-2);
+  f3 = d1+(-3);
+  f4 = d1+(-4);
+  f5 = d1+(-5);
+  t(1) = 1;
+catch
+  t(1) = 0;
+end
+
+if t(1)
+  t(2) = dassert(e1,f1);
+  t(3) = dassert(e2,f2);
+  t(4) = dassert(e3,f3);
+  t(5) = dassert(e4,f4);
+  t(6) = dassert(e5,f5);
+end
+T = all(t);
 %@eof:3
+
+%@test:4
+% Define some dates objects
+d1 = dates('2000-12-31');
+d2 = dates('2000-02-29');
+d3 = dates('2001-02-28');
+
+% Call the tested routine.
+try
+  f1 = d1+1;
+  f2 = d2+1;
+  f3 = d3+1;
+  t(1) = true;
+catch
+  t(1) = false;
+end
+
+if t(1)
+  t(2) = isequal(char(f1), '2001-01-01');
+  t(3) = isequal(char(f2), '2000-03-01');
+  t(4) = isequal(char(f3), '2001-03-01');
+end
+T = all(t);
+%@eof:4
+
diff --git a/src/@dates/remove_.m b/src/@dates/remove_.m
index 49463c24403380f937505cabb486ccbb2a6d7256..16976a115c07f46d348743b0d899b782cdea3314 100644
--- a/src/@dates/remove_.m
+++ b/src/@dates/remove_.m
@@ -15,7 +15,7 @@ function o = remove_(o, p) % --*-- Unitary tests --*--
 %
 % See also pop, setdiff
 
-% Copyright (C) 2013-2020 Dynare Team
+% Copyright © 2013-2020 Dynare Team
 %
 % This code is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -35,7 +35,7 @@ if nargin<2
 end
 
 if ~isdates(p)
-    error('dates:remove','Input argument %s has to be a dates object')
+    error('dates:remove','Input argument has to be a dates object')
 end
 
 if ~isequal(o.freq,p.freq)
@@ -43,101 +43,151 @@ if ~isequal(o.freq,p.freq)
 end
 
 if isoctave && octave_ver_less_than('6')
-    time = setdiff(o.time,p.time,'rows');
+    if o.freq==365
+        [~, io] = setdiff(o.time(:,1), p.time(:,1));
+        time = o.time(io,:);
+    else
+        time = setdiff(o.time,p.time,'rows');
+    end
 else
-    time = setdiff(o.time,p.time,'rows','legacy');
+    if o.freq==365
+        [~, io] = setdiff(o.time(:,1),p.time(:,1),'legacy');
+        time = o.time(io,:);
+    else
+        time = setdiff(o.time,p.time,'rows','legacy');
+    end
 end
 
 o.time = time;
 
+return
+
 %@test:1
-%$ % Define some dates objects
-%$ d = dates('1950Q1'):dates('1952Q4');
-%$ e = dates('1951Q1'):dates('1952Q4');
-%$ f = dates('1950Q1'):dates('1950Q4');
-%$
-%$ % Call the tested routine.
-%$ try
-%$     d.remove_(e);
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ % Check the results.
-%$ if t(1)
-%$     t(2) = dassert(d,f);
-%$ end
-%$
-%$ T = all(t);
+% Define some dates objects
+d = dates('1950Q1'):dates('1952Q4');
+e = dates('1951Q1'):dates('1952Q4');
+f = dates('1950Q1'):dates('1950Q4');
+
+% Call the tested routine.
+try
+    d.remove_(e);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+% Check the results.
+if t(1)
+    t(2) = dassert(d,f);
+end
+
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ % Define some dates objects
-%$ d = dates('1950Q1','1950Q2','1950Q1');
-%$ e = dates('1950Q1');
-%$ f = dates('1950Q2');
-%$
-%$ % Call the tested routine.
-%$ try
-%$     d.remove_(e);
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ % Check the results.
-%$ if t(1)
-%$     t(2) = dassert(d,f);
-%$ end
-%$
-%$ T = all(t);
+% Define some dates objects
+d = dates('1950Q1','1950Q2','1950Q1');
+e = dates('1950Q1');
+f = dates('1950Q2');
+
+% Call the tested routine.
+try
+    d.remove_(e);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+% Check the results.
+if t(1)
+    t(2) = dassert(d,f);
+end
+
+T = all(t);
 %@eof:2
 
 %@test:3
-%$ % Define some dates objects
-%$ d = dates('1950Q1','1950Q2','1950Q1');
-%$ e = dates('1950Q1');
-%$
-%$ % Call the tested routine.
-%$ try
-%$     d.remove();
-%$     t(1) = false;
-%$ catch
-%$     t(1) = true;
-%$ end
-%$
-%$ T = all(t);
+% Define some dates objects
+d = dates('1950Q1','1950Q2','1950Q1');
+e = dates('1950Q1');
+
+% Call the tested routine.
+try
+    d.remove();
+    t(1) = false;
+catch
+    t(1) = true;
+end
+
+T = all(t);
 %@eof:3
 
 %@test:4
-%$ % Define some dates objects
-%$ d = dates('1950Q1','1950Q2','1950Q1');
-%$ e = '1950Q1';
-%$
-%$ % Call the tested routine.
-%$ try
-%$     d.remove(e);
-%$     t(1) = false;
-%$ catch
-%$     t(1) = true;
-%$ end
-%$
-%$ T = all(t);
+% Define some dates objects
+d = dates('1950Q1','1950Q2','1950Q1');
+e = '1950Q1';
+
+% Call the tested routine.
+try
+    d.remove(e);
+    t(1) = false;
+catch
+    t(1) = true;
+end
+
+T = all(t);
 %@eof:4
 
 %@test:5
-%$ % Define some dates objects
-%$ d = dates('1950Q1','1950Q2','1950Q1');
-%$ e = dates('1950M1');
-%$
-%$ % Call the tested routine.
-%$ try
-%$     d.remove();
-%$     t(1) = false;
-%$ catch
-%$     t(1) = true;
-%$ end
-%$
-%$ T = all(t);
+% Define some dates objects
+d = dates('1950Q1','1950Q2','1950Q1');
+e = dates('1950M1');
+
+% Call the tested routine.
+try
+    d.remove();
+    t(1) = false;
+catch
+    t(1) = true;
+end
+
+T = all(t);
 %@eof:5
+
+%@test:6
+% Define some dates objects
+d = dates('2000-01-01'):dates('2000-01-04');
+
+% Call the tested routine.
+try
+    d.remove_(dates('2000-01-02'));
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    t(2) = isequal(d,dates('2000-01-01', '2000-01-03', '2000-01-04'));
+end
+
+T = all(t);
+%@eof:6
+
+%@test:7
+% Define some dates objects
+d = dates('2000-01-01'):dates('2000-01-04');
+
+% Call the tested routine.
+try
+    d.remove_(dates('2000-01-02', '2000-01-04'));
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    t(2) = isequal(d, dates('2000-01-01', '2000-01-03'));
+end
+
+T = all(t);
+%@eof:7
\ No newline at end of file
diff --git a/src/@dates/setdiff.m b/src/@dates/setdiff.m
index a800b45228ef3d56157d1ac1e84ed2a56df091c0..c72c5ef74d3f9c9a2888b2259c766515a4afecb7 100644
--- a/src/@dates/setdiff.m
+++ b/src/@dates/setdiff.m
@@ -12,7 +12,7 @@ function [q, io] = setdiff(o,p) % --*-- Unitary tests --*--
 %
 % See also pop, remove.
 
-% Copyright (C) 2013-2020 Dynare Team
+% Copyright © 2013-2020 Dynare Team
 %
 % This code is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -28,11 +28,11 @@ function [q, io] = setdiff(o,p) % --*-- Unitary tests --*--
 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
 
 if ~isa(o,'dates') || ~isa(o,'dates')
-    error('dates;setdiff','All input arguments must be dates objects!')
+    error('dates:setdiff','All input arguments must be dates objects!')
 end
 
 if ~isequal(o.freq,p.freq)
-    error('dates;setdiff','All input arguments must have common frequency!')
+    error('dates:setdiff','All input arguments must have common frequency!')
 end
 
 if isempty(p)
@@ -49,115 +49,148 @@ if isequal(o.length(),p.length()) && isequal(o, p)
 end
 
 if isoctave && octave_ver_less_than('6')
-    if nargout<2
-        time = setdiff(o.time,p.time,'rows');
+    if o.freq==2
+        [~, io] = setdiff(o.time(:,1), p.time(:,1));
+        time = o.time(io,:);
     else
-        [time, io] = setdiff(o.time,p.time,'rows');
+        if nargout<2
+            time = setdiff(o.time, p.time, 'rows');
+        else
+            [time, io] = setdiff(o.time, p.time, 'rows');
+        end
     end
 else
-    if nargout<2
-        time = setdiff(o.time,p.time,'rows','legacy');
+    if o.freq==365
+        [~, io] = setdiff(o.time(:,1), p.time(:,1), 'legacy');
+        time = o.time(io,:);
     else
-        [time, io] = setdiff(o.time,p.time,'rows','legacy');
+        if nargout<2
+            time = setdiff(o.time, p.time, 'rows', 'legacy');
+        else
+            [time, io] = setdiff(o.time, p.time, 'rows', 'legacy');
+        end
     end
 end
 
 q = dates(o.freq);
 q.time = time;
 
+return
+
 %@test:1
-%$ % Define some dates objects
-%$ d1 = dates('1950Q1'):dates('1950Q4') ;
-%$ d2 = dates('1950Q3'):dates('1950Q4') ;
-%$
-%$ % Call the tested routine.
-%$ try
-%$     c1 = setdiff(d1,d2);
-%$     [c2, i] = setdiff(d1,d2);
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ % Check the results.
-%$ if t(1)
-%$     t(2) = dassert(c1,c2);
-%$     t(3) = dassert(d1(i),c2);
-%$ end
-%$ T = all(t);
+% Define some dates objects
+d1 = dates('1950Q1'):dates('1950Q4') ;
+d2 = dates('1950Q3'):dates('1950Q4') ;
+
+% Call the tested routine.
+try
+    c1 = setdiff(d1,d2);
+    [c2, i] = setdiff(d1,d2);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+% Check the results.
+if t(1)
+    t(2) = isequal(c1,c2);
+    t(3) = isequal(d1(i),c2);
+end
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ % Define some dates objects
-%$ d1 = dates('1950Q1'):dates('1950Q4') ;
-%$ d2 = dates('1950M3'):dates('1950M4') ;
-%$
-%$ % Call the tested routine.
-%$ try
-%$     c1 = setdiff(d1,d2);
-%$     t(1) = false;
-%$ catch
-%$     t(1) = true;
-%$ end
-%$
-%$ T = all(t);
+% Define some dates objects
+d1 = dates('1950Q1'):dates('1950Q4') ;
+d2 = dates('1950M3'):dates('1950M4') ;
+
+% Call the tested routine.
+try
+    c1 = setdiff(d1,d2);
+    t(1) = false;
+catch
+    t(1) = true;
+end
+
+T = all(t);
 %@eof:2
 
 %@test:3
-%$ % Define some dates objects
-%$ d = dates('1950Q1'):dates('1950Q4') ;
-%$
-%$ % Call the tested routine.
-%$ try
-%$     c1 = setdiff(d,1);
-%$     t(1) = false;
-%$ catch
-%$     t(1) = true;
-%$ end
-%$
-%$ T = all(t);
+% Define some dates objects
+d = dates('1950Q1'):dates('1950Q4') ;
+
+% Call the tested routine.
+try
+    c1 = setdiff(d,1);
+    t(1) = false;
+catch
+    t(1) = true;
+end
+
+T = all(t);
 %@eof:3
 
 %@test:4
-%$ % Define some dates objects
-%$ d1 = dates('1950Q1'):dates('1950Q4') ;
-%$ d2 = dates('1951Q3'):dates('1951Q4') ;
-%$
-%$ % Call the tested routine.
-%$ try
-%$     c1 = setdiff(d1,d2);
-%$     [c2, i] = setdiff(d1,d2);
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ % Check the results.
-%$ if t(1)
-%$     t(2) = dassert(isequal(c1,d1),true);
-%$     t(3) = dassert(isequal(c1,d1(i)),true);
-%$ end
-%$ T = all(t);
+% Define some dates objects
+d1 = dates('1950Q1'):dates('1950Q4') ;
+d2 = dates('1951Q3'):dates('1951Q4') ;
+
+% Call the tested routine.
+try
+    c1 = setdiff(d1,d2);
+    [c2, i] = setdiff(d1,d2);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+% Check the results.
+if t(1)
+    t(2) = isequal(isequal(c1,d1),true);
+    t(3) = isequal(isequal(c1,d1(i)),true);
+end
+T = all(t);
 %@eof:4
 
 %@test:5
-%$ % Define some dates objects
-%$ d1 = dates('1950Q1'):dates('1950Q4') ;
-%$
-%$ % Call the tested routine.
-%$ try
-%$     c1 = setdiff(d1,d1);
-%$     [c2, i] = setdiff(d1,d1);
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ % Check the results.
-%$ if t(1)
-%$     t(2) = dassert(isempty(c1),true);
-%$     t(3) = dassert(isempty(c2),true);
-%$     t(4) = dassert(isempty(i),true);
-%$ end
-%$ T = all(t);
+% Define some dates objects
+d1 = dates('1950Q1'):dates('1950Q4') ;
+
+% Call the tested routine.
+try
+    c1 = setdiff(d1,d1);
+    [c2, i] = setdiff(d1,d1);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+% Check the results.
+if t(1)
+    t(2) = isequal(isempty(c1),true);
+    t(3) = isequal(isempty(c2),true);
+    t(4) = isequal(isempty(i),true);
+end
+T = all(t);
 %@eof:5
+
+%@test:6
+% Define some dates objects
+d1 = dates('2000-01-01'):dates('2000-01-10');
+d2 = dates('2000-01-05'):dates('2000-01-10');
+d3 = dates('2000-01-01'):dates('2000-01-04');
+% Call the tested routine.
+try
+    c1 = setdiff(d1, d2);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+% Check the results.
+if t(1)
+    t(2) = isequal(c1, d3);
+end
+T = all(t);
+%@eof:6
+
diff --git a/src/@dates/sort_.m b/src/@dates/sort_.m
index e4ef50ac7dfbf68e5b45c2c66ba871063e51053d..9721b461c2ab662420ed8883a800341c6cffadcf 100644
--- a/src/@dates/sort_.m
+++ b/src/@dates/sort_.m
@@ -8,7 +8,7 @@ function o = sort_(o) % --*-- Unitary tests --*--
 % OUTPUTS
 % - o [dates] with dates sorted by increasing order.
 
-% Copyright (C) 2015-2017 Dynare Team
+% Copyright © 2015-2020 Dynare Team
 %
 % This code is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -27,60 +27,85 @@ if isequal(o.ndat(),1)
     return
 end
 
-o.time = sortrows(o.time,[1,2]);
+if o.freq==365
+    [~, io] = sort(o.time(:,1));
+    o.time(:,1) =  o.time(io,1);
+else
+    o.time = sortrows(o.time,[1,2]);
+end
+
+return
 
 %@test:1
-%$ % Define some dates
-%$ B1 = '1953Q4';
-%$ B2 = '1950Q2';
-%$ B3 = '1950Q1';
-%$ B4 = '1945Q3';
-%$
-%$ % Define expected results.
-%$ e.time = [1945 3; 1950 1; 1950 2; 1953 4];
-%$ e.freq = 4;
-%$
-%$ % Call the tested routine.
-%$ d = dates(B1,B2,B3,B4);
-%$ try
-%$     d.sort_();
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ % Check the results.
-%$ if t(1)
-%$     t(2) = dassert(d.time,e.time);
-%$     t(3) = dassert(d.freq,e.freq);
-%$ end
-%$ T = all(t);
+% Define some dates
+B1 = '1953Q4';
+B2 = '1950Q2';
+B3 = '1950Q1';
+B4 = '1945Q3';
+
+% Define expected results.
+e.time = [1945 3; 1950 1; 1950 2; 1953 4];
+e.freq = 4;
+
+% Call the tested routine.
+d = dates(B1,B2,B3,B4);
+try
+    d.sort_();
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+% Check the results.
+if t(1)
+    t(2) = dassert(d.time,e.time);
+    t(3) = dassert(d.freq,e.freq);
+end
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ % Define some dates
-%$ B1 = '1953Q4';
-%$ B2 = '1950Q2';
-%$ B3 = '1950Q1';
-%$ B4 = '1945Q3';
-%$
-%$ % Define expected results.
-%$ e.time = [1945 3; 1950 1; 1950 2; 1953 4];
-%$ e.freq = 4;
-%$
-%$ % Call the tested routine.
-%$ d = dates(B1,B2,B3,B4);
-%$ try
-%$     c = sort_(d);
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ % Check the results.
-%$ if t(1)
-%$     t(2) = dassert(d.time,e.time);
-%$     t(3) = dassert(d.freq,e.freq);
-%$ end
-%$ T = all(t);
-%@eof:2
\ No newline at end of file
+% Define some dates
+B1 = '1953Q4';
+B2 = '1950Q2';
+B3 = '1950Q1';
+B4 = '1945Q3';
+
+% Define expected results.
+e.time = [1945 3; 1950 1; 1950 2; 1953 4];
+e.freq = 4;
+
+% Call the tested routine.
+d = dates(B1,B2,B3,B4);
+try
+    c = sort_(d);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+% Check the results.
+if t(1)
+    t(2) = dassert(d.time,e.time);
+    t(3) = dassert(d.freq,e.freq);
+end
+T = all(t);
+%@eof:2
+
+%@test:3
+d = dates('2000-01-01', '2001-01-01', '1999-01-02');
+try
+    d.sort_();
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+% Check the results.
+if t(1)
+    t(2) = isequal(d,dates('1999-01-02', '2000-01-01', '2001-01-01'));
+end
+T = all(t);
+%@eof:3
+
+
diff --git a/src/@dates/strings.m b/src/@dates/strings.m
index 5557c1429993f908c6c0e9d01aa488f409d9ccee..1ffefa979120d0c02c2f3fb409327514cc804ce4 100644
--- a/src/@dates/strings.m
+++ b/src/@dates/strings.m
@@ -3,12 +3,12 @@ function m = strings(o) % --*-- Unitary tests --*--
 % Returns a cell array of strings containing the dates
 %
 % INPUTS
-% - o [dates] object with n elements.
+% - o [dates]        object with n elements.
 %
 % OUTPUTS
 % - m [cell of char] object with n elements.
 
-% Copyright (C) 2013-2017 Dynare Team
+% Copyright © 2013-2020 Dynare Team
 %
 % This code is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -29,26 +29,53 @@ for i = 1:o.length()
     m(i) = { date2string(o.time(i,:), o.freq) };
 end
 
+return
+
 %@test:1
-%$ % Define a dates objects
-%$ d = dates('1950Q1'):dates('1950Q3');
-%$
-%$ % Call the tested routine.
-%$ try
-%$     m = strings(d);
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ % Check the results.
-%$ if t(1)
-%$     t(2) = iscell(m);
-%$     t(3) = dassert(m{1}, '1950Q1');
-%$     t(4) = dassert(m{2}, '1950Q2');
-%$     t(5) = dassert(m{3}, '1950Q3');
-%$     t(6) = dassert(length(m), 3);
-%$ end
-%$
-%$ T = all(t);
+% Define a dates objects
+d = dates('1950Q1'):dates('1950Q3');
+
+% Call the tested routine.
+try
+    m = strings(d);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+% Check the results.
+if t(1)
+    t(2) = iscell(m);
+    t(3) = dassert(m{1}, '1950Q1');
+    t(4) = dassert(m{2}, '1950Q2');
+    t(5) = dassert(m{3}, '1950Q3');
+    t(6) = dassert(length(m), 3);
+end
+
+T = all(t);
 %@eof:1
+
+
+%@test:2
+% Define a dates objects
+d = dates('2000-01-01'):dates('2000-01-03');
+
+% Call the tested routine.
+try
+    m = strings(d);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+% Check the results.
+if t(1)
+    t(2) = iscell(m);
+    t(3) = dassert(m{1}, '2000-01-01');
+    t(4) = dassert(m{2}, '2000-01-02');
+    t(5) = dassert(m{3}, '2000-01-03');
+    t(6) = dassert(length(m), 3);
+end
+
+T = all(t);
+%@eof:2
\ No newline at end of file
diff --git a/src/@dates/subperiod.m b/src/@dates/subperiod.m
index 0722b672291ff83b258315510e982103ea90f974..96e64fa01d1e150f220e8e07d3393b091102b6df 100644
--- a/src/@dates/subperiod.m
+++ b/src/@dates/subperiod.m
@@ -1,8 +1,8 @@
 function s = subperiod(d)
 
-% Returns the subperiod (half-year, quarter, month or week depending on the frequency).
+% Returns the subperiod (half-year, quarter, or month depending on the frequency).
 
-% Copyright (C) 2016-2020 Dynare Team
+% Copyright © 2016-2020 Dynare Team
 %
 % This code is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -17,4 +17,8 @@ function s = subperiod(d)
 % You should have received a copy of the GNU General Public License
 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
 
+if d.freq==365
+    error('Method not available for daily frequency.')
+end
+
 s = d.time(2);
\ No newline at end of file
diff --git a/src/@dates/subsref.m b/src/@dates/subsref.m
index aff73554da462c3545a7c1d03838c2fc49b7eaca..9b4b76b197af439116871231a1742872c39161dd 100644
--- a/src/@dates/subsref.m
+++ b/src/@dates/subsref.m
@@ -13,7 +13,7 @@ function B = subsref(A,S) % --*-- Unitary tests --*--
 % 1. The type of the returned argument depends on the content of S.
 % 2. See the matlab's documentation about the subsref method.
 
-% Copyright (C) 2011-2020 Dynare Team
+% Copyright © 2011-2020 Dynare Team
 %
 % This code is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -126,7 +126,13 @@ switch S(1).type
                 if ~isequal(n1,n2,n3)
                     error('dates::subsref: Second, third and fourth input arguments must have the same number of elements!')
                 end
-                B.time = [S(1).subs{2}, S(1).subs{3}, S(1).subs{4}];
+                % Check that the provided inputs form a valid date
+                for i=1:length(S(1).subs{1})
+                    if ~isvalidday([S(1).subs{1}(i), S(1).subs{2}(i), S(1).subs{3}(i)])
+                        error('Triplet (%u, %u, %u) is not a valid date for a day.', S(1).subs{1}(i), S(1).subs{2}(i), S(1).subs{3}(i))
+                    end
+                end
+                B.time = [datenum([S(1).subs{1}, S(1).subs{2}, S(1).subs{3}]), NaN(length(S(1).subs{1}), 1)];
             else
                 error('dates::subsref: Wrong calling sequence!')
             end
@@ -181,7 +187,13 @@ switch S(1).type
                 if ~isequal(n3,n2,n1)
                     error('dates::subsref: All arguments must have the same number of rows!')
                 end
-                B.time = [S(1).subs{1}, S(1).subs{2}, S(1).subs{3}];
+                % Check that the provided inputs form a valid date
+                for i=1:length(S(1).subs{1})
+                    if ~isvalidday([S(1).subs{1}(i), S(1).subs{2}(i), S(1).subs{3}(i)])
+                        error('Triplet (%u, %u, %u) is not a valid date for a day.', S(1).subs{1}(i), S(1).subs{2}(i), S(1).subs{3}(i))
+                    end
+                end
+                B.time = [datenum([S(1).subs{1}, S(1).subs{2}, S(1).subs{3}]), NaN(length(S(1).subs{1}), 1)];
             else
                 error('dates::subsref: Wrong number of inputs!')
             end
@@ -207,217 +219,213 @@ if ~isempty(S)
     B = subsref(B, S);
 end
 
+return
+
 %@test:1
-%$ % Define a dates object
-%$ B = dates('1950Q1','1950Q2','1950Q3','1950Q4','1951Q1');
-%$
-%$ % Try to extract a sub-dates object.
-%$ d = B(2:3);
-%$
-%$ if isa(d,'dates')
-%$     t(1) = 1;
-%$ else
-%$     t(1) = 0;
-%$ end
-%$
-%$ if t(1)
-%$     t(2) = dassert(d.freq,B.freq);
-%$     t(3) = dassert(d.time,[1950 2; 1950 3]);
-%$     t(4) = dassert(d.ndat(),2);
-%$ end
-%$ T = all(t);
+% Define a dates object
+B = dates('1950Q1','1950Q2','1950Q3','1950Q4','1951Q1');
+
+% Try to extract a sub-dates object.
+try
+    d = B(2:3);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    t(2) = isequal(d.freq, B.freq);
+    t(3) = isequal(d.time, [1950 2; 1950 3]);
+    t(4) = isequal(d.ndat(), 2);
+end
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ % Define a dates object
-%$ B = dates('1950Q1'):dates('1960Q3');
-%$
-%$ % Try to extract a sub-dates object and apply a method
-%$
-%$ d = B(2:3).sort ;
-%$
-%$ if isa(d,'dates')
-%$     t(1) = 1;
-%$ else
-%$     t(1) = 0;
-%$ end
-%$
-%$ if t(1)
-%$     t(2) = dassert(d.freq,B.freq);
-%$     t(3) = dassert(d.time,[1950 2; 1950 3]);
-%$     t(4) = dassert(d.ndat(),2);
-%$ end
-%$ T = all(t);
+% Define a dates object
+B = dates('1950Q1'):dates('1960Q3');
+
+% Try to extract a sub-dates object and apply a method
+try
+    d = B(2:3).sort;
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    t(2) = isequal(d.freq,B.freq);
+    t(3) = isequal(d.time,[1950 2; 1950 3]);
+    t(4) = isequal(d.ndat(),2);
+end
+T = all(t);
 %@eof:2
 
 %@test:3
-%$ % Define a dates object
-%$ B = dates('1950Q1'):dates('1960Q3');
-%$
-%$ % Try to extract a sub-dates object and apply a method
-%$
-%$ d = B(2:3).sort() ;
-%$
-%$ if isa(d,'dates')
-%$     t(1) = 1;
-%$ else
-%$     t(1) = 0;
-%$ end
-%$
-%$ if t(1)
-%$     t(2) = dassert(d.freq,B.freq);
-%$     t(3) = dassert(d.time,[1950 2; 1950 3]);
-%$     t(4) = dassert(d.ndat(),2);
-%$ end
-%$ T = all(t);
+% Define a dates object
+B = dates('1950Q1'):dates('1960Q3');
+
+% Try to extract a sub-dates object and apply a method
+try
+    d = B(2:3).sort();
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    t(2) = isequal(d.freq,B.freq);
+    t(3) = isequal(d.time,[1950 2; 1950 3]);
+    t(4) = isequal(d.ndat(),2);
+end
+T = all(t);
 %@eof:3
 
 %@test:4
-%$ % Define a dates object
-%$ B = dates('1950Q1','1950Q2','1950Q3','1950Q4','1951Q1');
-%$
-%$ % Try to extract a sub-dates object.
-%$ d = B(2);
-%$
-%$ if isa(d,'dates')
-%$     t(1) = 1;
-%$ else
-%$     t(1) = 0;
-%$ end
-%$
-%$ if t(1)
-%$     t(2) = dassert(d.freq,B.freq);
-%$     t(3) = dassert(d.time,[1950 2]);
-%$     t(4) = dassert(d.ndat(),1);
-%$ end
-%$ T = all(t);
+% Define a dates object
+B = dates('1950Q1','1950Q2','1950Q3','1950Q4','1951Q1');
+
+% Try to extract a sub-dates object.
+try
+    d = B(2);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    t(2) = isequal(d.freq,B.freq);
+    t(3) = isequal(d.time,[1950 2]);
+    t(4) = isequal(d.ndat(),1);
+end
+T = all(t);
 %@eof:4
 
 %@test:5
-%$ % Define an empty dates object with quaterly frequency.
-%$ qq = dates('Q');
-%$
-%$ % Define a ranges of dates using qq.
-%$ try
-%$     r1 = qq(1950,1):qq(1950,3);%qq([1950, 3]);
-%$     t(1) = 1;
-%$ catch
-%$     t(1) = 0;
-%$ end
-%$ if t(1)
-%$     try
-%$         r2 = qq([1950, 1; 1950, 2; 1950, 3]);
-%$         t(2) = 1;
-%$     catch
-%$         t(2) = 0;
-%$     end
-%$ end
-%$ if t(1) && t(2)
-%$     try
-%$         r3 = qq(1950*ones(3,1), transpose(1:3));
-%$         t(3) = 1;
-%$     catch
-%$         t(3) = 0;
-%$     end
-%$ end
-%$
-%$ if t(1) && t(2) && t(3)
-%$     t(4) = dassert(r1,r2);
-%$     t(5) = dassert(r1,r3);
-%$ end
-%$ T = all(t);
+% Define an empty dates object with quaterly frequency.
+qq = dates('Q');
+
+% Define a ranges of dates using qq.
+try
+    r1 = qq(1950,1):qq(1950,3);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    try
+        r2 = qq([1950, 1; 1950, 2; 1950, 3]);
+        t(2) = true;
+    catch
+        t(2) = false;
+    end
+end
+if t(1) && t(2)
+    try
+        r3 = qq(1950*ones(3,1), transpose(1:3));
+        t(3) = true;
+    catch
+        t(3) = false;
+    end
+end
+
+if t(1) && t(2) && t(3)
+    t(4) = isequal(r1,r2);
+    t(5) = isequal(r1,r3);
+end
+T = all(t);
 %@eof:5
 
 %@test:6
-%$ % Define an empty dates object with quaterly frequency.
-%$ date = dates();
-%$
-%$ % Define a ranges of dates using qq.
-%$ try
-%$     r1 = date(4,1950,1):date(4,[1950, 3]);
-%$     t(1) = 1;
-%$ catch
-%$     t(1) = 0;
-%$ end
-%$ if t(1)
-%$     try
-%$         r2 = date(4,[1950, 1; 1950, 2; 1950, 3]);
-%$         t(2) = 1;
-%$     catch
-%$         t(2) = 0;
-%$     end
-%$ end
-%$ if t(1) && t(2)
-%$     try
-%$         r3 = date(4,1950*ones(3,1), transpose(1:3));
-%$         t(3) = 1;
-%$     catch
-%$         t(3) = 0;
-%$     end
-%$ end
-%$
-%$ if t(1) && t(2) && t(3)
-%$     t(4) = dassert(r1,r2);
-%$     t(5) = dassert(r1,r3);
-%$ end
-%$ T = all(t);
+% Define an empty dates object with quaterly frequency.
+date = dates();
+
+% Define a ranges of dates using qq.
+try
+    r1 = date(4,1950,1):date(4,[1950, 3]);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+if t(1)
+    try
+        r2 = date(4,[1950, 1; 1950, 2; 1950, 3]);
+        t(2) = true;
+    catch
+        t(2) = false;
+    end
+end
+if t(1) && t(2)
+    try
+        r3 = date(4,1950*ones(3,1), transpose(1:3));
+        t(3) = true;
+    catch
+        t(3) = false;
+    end
+end
+
+if t(1) && t(2) && t(3)
+    t(4) = isequal(r1, r2);
+    t(5) = isequal(r1, r3);
+end
+T = all(t);
 %@eof:6
 
 %@test:7
-%$ % Define a dates object
-%$ B = dates('1950Q1','1950Q2','1950Q3','1950Q4','1951Q1');
-%$
-%$ % Try to extract a sub-dates object.
-%$ try
-%$     d = B([]);
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ if t(1)
-%$     t(2) = dassert(isa(d,'dates'), true);
-%$     t(3) = dassert(isempty(d), true);
-%$ end
-%$ T = all(t);
+% Define a dates object
+B = dates('1950Q1','1950Q2','1950Q3','1950Q4','1951Q1');
+
+% Try to extract a sub-dates object.
+try
+    d = B([]);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    t(2) = isequal(isa(d,'dates'), true);
+    t(3) = isequal(isempty(d), true);
+end
+T = all(t);
 %@eof:7
 
 %@test:8
-%$ % Define a dates object
-%$ B = dates('1950-11-15','1950-11-16','1950-11-17','1950-11-18');
-%$
-%$ % Try to extract a sub-dates object.
-%$ try
-%$     d = B([]);
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ if t(1)
-%$     t(2) = dassert(isa(d,'dates'), true);
-%$     t(3) = dassert(isempty(d), true);
-%$ end
-%$ T = all(t);
+% Define a dates object
+B = dates('1950-11-15','1950-11-16','1950-11-17','1950-11-18');
+
+% Try to extract a sub-dates object.
+try
+    d = B([]);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    t(2) = isequal(isa(d,'dates'), true);
+    t(3) = isequal(isempty(d), true);
+end
+T = all(t);
 %@eof:8
 
 %@test:9
-%$ % Define a dates object
-%$ B = dates('1950-11-15','1950-11-16','1950-11-17','1950-11-18');
-%$
-%$ % Try to extract a sub-dates object.
-%$ d = B(2);
-%$
-%$ if isa(d,'dates')
-%$     t(1) = 1;
-%$ else
-%$     t(1) = 0;
-%$ end
-%$
-%$ if t(1)
-%$     t(2) = dassert(d.freq,B.freq);
-%$     t(3) = dassert(d.time,[1950 11 16]);
-%$     t(4) = dassert(d.ndat(),1);
-%$ end
-%$ T = all(t);
+% Define a dates object
+B = dates('1950-11-15','1950-11-16','1950-11-17','1950-11-18');
+
+% Try to extract a sub-dates object.
+try
+    d = B(2);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    t(2) = isequal(d.freq,B.freq);
+    t(3) = isequal(d.time(1), 712543) && isnan(d.time(2));
+    t(4) = isequal(d.ndat(),1);
+end
+T = all(t);
 %@eof:9
\ No newline at end of file
diff --git a/src/@dates/uminus.m b/src/@dates/uminus.m
index 840592182f6524fe154a18d225b233e549e35452..a04da22877fd1e5b0ddac22a0bef3b958ccadf77 100644
--- a/src/@dates/uminus.m
+++ b/src/@dates/uminus.m
@@ -8,7 +8,7 @@ function o = uminus(o)  % --*-- Unitary tests --*--
 % OUTPUTS
 % - o [dates]
 
-% Copyright (C) 2013-2017 Dynare Team
+% Copyright © 2013-2020 Dynare Team
 %
 % This code is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -23,53 +23,77 @@ function o = uminus(o)  % --*-- Unitary tests --*--
 % You should have received a copy of the GNU General Public License
 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
 
-o.time(:,2) = o.time(:,2)-1;
-idx = find(o.time(:,2)==0);
-o.time(idx,1) = o.time(idx,1)-1;
-o.time(idx,2) = o.freq;
+if o.freq==365
+    o.time(:,1) = o.time(:,1)-1;
+else
+    o.time(:,2) = o.time(:,2)-1;
+    idx = find(o.time(:,2)==0);
+    o.time(idx,1) = o.time(idx,1)-1;
+    o.time(idx,2) = o.freq;
+end
+
+return
 
 %@test:1
-%$ % Define some dates
-%$ date_1 = '1950Y';
-%$ date_2 = '1950Q2';
-%$ date_3 = '1950Q1';
-%$ date_4 = '1950M2';
-%$ date_5 = '1950M1';
-%$
-%$ % Call the tested routine.
-%$ d1 = dates(date_1); -d1;
-%$ d2 = dates(date_2); -d2;
-%$ d3 = dates(date_3); -d3;
-%$ d4 = dates(date_4); -d4;
-%$ d5 = dates(date_5); -d5;
-%$ i1 = (d1==dates('1949Y'));
-%$ i2 = (d2==dates('1950Q1'));
-%$ i3 = (d3==dates('1949Q4'));
-%$ i4 = (d4==dates('1950M1'));
-%$ i5 = (d5==dates('1949M12'));
-%$
-%$ % Check the results.
-%$ t(1) = dassert(i1,true);
-%$ t(2) = dassert(i2,true);
-%$ t(3) = dassert(i3,true);
-%$ t(4) = dassert(i4,true);
-%$ t(5) = dassert(i5,true);
-%$ T = all(t);
+% Define some dates
+date_1 = '1950Y';
+date_2 = '1950Q2';
+date_3 = '1950Q1';
+date_4 = '1950M2';
+date_5 = '1950M1';
+
+% Call the tested routine.
+try
+    d1 = dates(date_1); -d1;
+    d2 = dates(date_2); -d2;
+    d3 = dates(date_3); -d3;
+    d4 = dates(date_4); -d4;
+    d5 = dates(date_5); -d5;
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    t(2) = (d1==dates('1949Y'));
+    t(3) = (d2==dates('1950Q1'));
+    t(4) = (d3==dates('1949Q4'));
+    t(5) = (d4==dates('1950M1'));
+    t(6) = (d5==dates('1949M12'));
+end
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ d1 = dates('1950Q1','1950Q2','1950Q3','1950Q4','1951Q1');
-%$ d2 = dates('1949Q4','1950Q1','1950Q2','1950Q3','1950Q4');
-%$ try
-%$   -d1;
-%$   t(1) = 1;
-%$ catch
-%$   t(1) = 0;
-%$ end
-%$
-%$ if t(1)
-%$   t(2) = dassert(all(d2==d1),true);
-%$ end
-%$
-%$ T = all(t);
-%@eof:2
\ No newline at end of file
+d1 = dates('1950Q1','1950Q2','1950Q3','1950Q4','1951Q1');
+d2 = dates('1949Q4','1950Q1','1950Q2','1950Q3','1950Q4');
+try
+  -d1;
+  t(1) = true;
+catch
+  t(1) = false;
+end
+
+if t(1)
+  t(2) = isequal(d2, d1);
+end
+
+T = all(t);
+%@eof:2
+
+%@test:3
+d1 = dates('2000-01-01');
+d2 = dates('1999-12-31');
+try
+  -d1;
+  t(1) = true;
+catch
+  t(1) = false;
+end
+
+if t(1)
+  t(2) = (d2==d1);
+end
+
+T = all(t);
+%@eof:3
\ No newline at end of file
diff --git a/src/@dates/union.m b/src/@dates/union.m
index 3d56a20fb15f3be28296b628e69f776b7c171754..59868ad0ce6f3f5618928bdd9254b3dc3cab9e03 100644
--- a/src/@dates/union.m
+++ b/src/@dates/union.m
@@ -6,12 +6,12 @@ function o = union(varargin) % --*-- Unitary tests --*--
 % - varargin [dates]
 %
 % OUPUTS
-% - o [dates]
+% - o        [dates]
 %
 % REMARKS
 % 1. Elements in o are sorted by increasing order.
 
-% Copyright (C) 2013-2017 Dynare Team
+% Copyright © 2013-2020 Dynare Team
 %
 % This code is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -37,24 +37,42 @@ end
 
 o = sort(unique(horzcat(varargin{:})));
 
+return
+
 %@test:1
-%$ % Define some dates objects
-%$ d1 = dates('1950Q1'):dates('1959Q4') ;
-%$ d2 = dates('1960Q1'):dates('1969Q4') ;
-%$ d3 = dates('1970Q1'):dates('1979Q4') ;
-%$
-%$ % Call the tested routine.
-%$ e1 = union(d1);
-%$ e2 = union(d1,d2);
-%$ e3 = union(d1,d2,d3);
-%$ e4 = union(d1,d2,d3,d2+d3);
-%$ e5 = union(d1,d2,d3,d2);
-%$
-%$ % Check the results.
-%$ t(1) = dassert(e1,d1);
-%$ t(2) = dassert(e2,d1+d2);
-%$ t(3) = dassert(e3,d1+d2+d3);
-%$ t(4) = dassert(e4,d1+d2+d3);
-%$ t(5) = dassert(e5,d1+d2+d3);
-%$ T = all(t);
+% Define some dates objects
+d1 = dates('1950Q1'):dates('1959Q4') ;
+d2 = dates('1960Q1'):dates('1969Q4') ;
+d3 = dates('1970Q1'):dates('1979Q4') ;
+
+% Call the tested routine.
+e1 = union(d1);
+e2 = union(d1,d2);
+e3 = union(d1,d2,d3);
+e4 = union(d1,d2,d3,d2+d3);
+e5 = union(d1,d2,d3,d2);
+
+% Check the results.
+t(1) = dassert(e1,d1);
+t(2) = dassert(e2,d1+d2);
+t(3) = dassert(e3,d1+d2+d3);
+t(4) = dassert(e4,d1+d2+d3);
+t(5) = dassert(e5,d1+d2+d3);
+T = all(t);
+%@eof:1
+
+%@test:1
+% Define some dates objects
+d1 = dates('2000-01-01'):dates('2000-01-05');
+d2 = dates('2000-01-05'):dates('2000-01-10');
+d3 = dates('2000-01-01'):dates('2000-01-10');
+
+% Call the tested routine.
+e1 = union(d1);
+e2 = union(d1,d2);
+
+% Check the results.
+t(1) = isequal(e1, d1);
+t(2) = isequal(e2, d3);
+T = all(t);
 %@eof:1
\ No newline at end of file
diff --git a/src/@dates/unique.m b/src/@dates/unique.m
index 86c6963db4ced270e51a344c3efd82175d18ad16..933f5129df6dfb19a4596a78accb3cb2188e1af0 100644
--- a/src/@dates/unique.m
+++ b/src/@dates/unique.m
@@ -11,7 +11,7 @@ function o = unique(o) % --*-- Unitary tests --*--
 % REMARKS
 % 1. Only the last occurence of a date is kept.
 
-% Copyright (C) 2013-2017 Dynare Team
+% Copyright © 2013-2020 Dynare Team
 %
 % This code is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -33,91 +33,112 @@ end
 o = copy(o);
 o.unique_();
 
+return
+
 %@test:1
-%$ % Define some dates
-%$ B1 = '1953Q4';
-%$ B2 = '1950Q2';
-%$ B3 = '1950q1';
-%$ B4 = '1945Q3';
-%$ B5 = '1950Q2';
-%$
-%$ % Define expected results.
-%$ e.time = [1953 4; 1950 1; 1945 3; 1950 2];
-%$ e.freq = 4;
-%$ f.time = [1953 4; 1950 2; 1950 1; 1945 3; 1950 2];
-%$
-%$ % Call the tested routine.
-%$ d = dates(B1,B2,B3,B4,B5);
-%$ try
-%$     c = d.unique();
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ % Check the results.
-%$ if t(1)
-%$     t(2) = dassert(d.time,f.time);
-%$     t(3) = dassert(c.time,e.time);
-%$     t(4) = dassert(d.freq,e.freq);
-%$ end
-%$ T = all(t);
+% Define some dates
+B1 = '1953Q4';
+B2 = '1950Q2';
+B3 = '1950q1';
+B4 = '1945Q3';
+B5 = '1950Q2';
+
+% Define expected results.
+e.time = [1953 4; 1950 1; 1945 3; 1950 2];
+e.freq = 4;
+f.time = [1953 4; 1950 2; 1950 1; 1945 3; 1950 2];
+
+% Call the tested routine.
+d = dates(B1,B2,B3,B4,B5);
+try
+    c = d.unique();
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+% Check the results.
+if t(1)
+    t(2) = dassert(d.time,f.time);
+    t(3) = dassert(c.time,e.time);
+    t(4) = dassert(d.freq,e.freq);
+end
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ % Define some dates
-%$ B1 = '1953Q4';
-%$ B2 = '1950Q2';
-%$ B3 = '1950q1';
-%$ B4 = '1945Q3';
-%$ B5 = '1950Q2';
-%$
-%$ % Define expected results.
-%$ e.time = [1953 4; 1950 1; 1945 3; 1950 2];
-%$ e.freq = 4;
-%$ f.time = [1953 4; 1950 2; 1950 1; 1945 3; 1950 2];
-%$
-%$ % Call the tested routine.
-%$ d = dates(B1,B2,B3,B4,B5);
-%$ try
-%$     c = unique(d);
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ % Check the results.
-%$ if t(1)
-%$     t(2) = dassert(d.time,f.time);
-%$     t(3) = dassert(c.time,e.time);
-%$     t(4) = dassert(d.freq,e.freq);
-%$ end
-%$ T = all(t);
+% Define some dates
+B1 = '1953Q4';
+B2 = '1950Q2';
+B3 = '1950q1';
+B4 = '1945Q3';
+B5 = '1950Q2';
+
+% Define expected results.
+e.time = [1953 4; 1950 1; 1945 3; 1950 2];
+e.freq = 4;
+f.time = [1953 4; 1950 2; 1950 1; 1945 3; 1950 2];
+
+% Call the tested routine.
+d = dates(B1,B2,B3,B4,B5);
+try
+    c = unique(d);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+% Check the results.
+if t(1)
+    t(2) = dassert(d.time,f.time);
+    t(3) = dassert(c.time,e.time);
+    t(4) = dassert(d.freq,e.freq);
+end
+T = all(t);
 %@eof:2
 
 %@test:3
-%$ % Define some dates
-%$ B1 = '1953Q4';
-%$
-%$ % Define expected results.
-%$ e.time = [1953 4];
-%$ e.freq = 4;
-%$ f.time = e.time;
-%$
-%$ % Call the tested routine.
-%$ d = dates(B1);
-%$ try
-%$     c = d.unique();
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ % Check the results.
-%$ if t(1)
-%$     t(2) = dassert(d.time,f.time);
-%$     t(3) = dassert(c.time,e.time);
-%$     t(4) = dassert(d.freq,e.freq);
-%$ end
-%$ T = all(t);
+% Define some dates
+B1 = '1953Q4';
+
+% Define expected results.
+e.time = [1953 4];
+e.freq = 4;
+f.time = e.time;
+
+% Call the tested routine.
+d = dates(B1);
+try
+    c = d.unique();
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+% Check the results.
+if t(1)
+    t(2) = dassert(d.time,f.time);
+    t(3) = dassert(c.time,e.time);
+    t(4) = dassert(d.freq,e.freq);
+end
+T = all(t);
 %@eof:3
+
+%@test:4
+% Define some dates
+d1 = [dates('2000-01-01'), dates('2000-01-02'), dates('2000-01-01')];
+
+% Call the tested routine.
+try
+    d2 = d1.unique();
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+% Check the results.
+if t(1)
+    t(2) = isequal(d2, dates('2000-01-02', '2000-01-01'));
+end
+T = all(t);
+%@eof:4
\ No newline at end of file
diff --git a/src/@dates/unique_.m b/src/@dates/unique_.m
index 63a84be20c2121451929d08702ea80ed16de9d94..25f122c050bfb45e8dcbc677b9591b46aaee68af 100644
--- a/src/@dates/unique_.m
+++ b/src/@dates/unique_.m
@@ -11,7 +11,7 @@ function o = unique_(o) % --*-- Unitary tests --*--
 % REMARKS
 % 1. Only the last occurence of a date is kept.
 
-% Copyright (C) 2013-2020 Dynare Team
+% Copyright © 2013-2020 Dynare Team
 %
 % This code is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -31,67 +31,77 @@ if o.ndat()<=1
 end
 
 if isoctave && octave_ver_less_than('6')
-    [tmp, id, jd] = unique(o.time,'rows');
+    if o.freq==365
+        [~, id, jd] = unique(o.time(:,1));
+    else
+        [~, id, jd] = unique(o.time,'rows');
+    end
 else
-    [tmp, id, jd] = unique(o.time,'rows','legacy');
+    if o.freq==365
+        [~, id, jd] = unique(o.time(:,1), 'legacy');
+    else
+        [~, id, jd] = unique(o.time, 'rows', 'legacy');
+    end
 end
 
 o.time = o.time(sort(id),:);
 
-%@test:1
-%$ % Define some dates
-%$ B1 = '1953Q4';
-%$ B2 = '1950Q2';
-%$ B3 = '1950q1';
-%$ B4 = '1945Q3';
-%$ B5 = '1950Q2';
-%$
-%$ % Define expected results.
-%$ e.time = [1953 4; 1950 1; 1945 3; 1950 2];
-%$ e.freq = 4;
-%$
-%$ % Call the tested routine.
-%$ d = dates(B1,B2,B3,B4,B5);
-%$ try
-%$     d.unique_();
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ % Check the results.
-%$ if t(1)
-%$     t(2) = dassert(d.time,e.time);
-%$     t(3) = dassert(d.freq,e.freq);
-%$ end
-%$ T = all(t);
-%@eof:1
+return
 
 %@test:1
-%$ % Define some dates
-%$ B1 = '1953Q4';
-%$ B2 = '1950Q2';
-%$ B3 = '1950q1';
-%$ B4 = '1945Q3';
-%$ B5 = '1950Q2';
-%$
-%$ % Define expected results.
-%$ e.time = [1953 4; 1950 1; 1945 3; 1950 2];
-%$ e.freq = 4;
-%$
-%$ % Call the tested routine.
-%$ d = dates(B1,B2,B3,B4,B5);
-%$ try
-%$     unique_(d);
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ % Check the results.
-%$ if t(1)
-%$     t(2) = dassert(d.time,e.time);
-%$     t(3) = dassert(d.freq,e.freq);
-%$ end
-%$ T = all(t);
+% Define some dates
+B1 = '1953Q4';
+B2 = '1950Q2';
+B3 = '1950q1';
+B4 = '1945Q3';
+B5 = '1950Q2';
+
+% Define expected results.
+e.time = [1953 4; 1950 1; 1945 3; 1950 2];
+e.freq = 4;
+
+% Call the tested routine.
+d = dates(B1,B2,B3,B4,B5);
+try
+    d.unique_();
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+% Check the results.
+if t(1)
+    t(2) = isequal(d.time,e.time);
+    t(3) = isequal(d.freq,e.freq);
+end
+T = all(t);
 %@eof:1
+
+%@test:2
+% Define some dates
+B1 = '1953Q4';
+B2 = '1950Q2';
+B3 = '1950q1';
+B4 = '1945Q3';
+B5 = '1950Q2';
+
+% Define expected results.
+e.time = [1953 4; 1950 1; 1945 3; 1950 2];
+e.freq = 4;
+
+% Call the tested routine.
+d = dates(B1,B2,B3,B4,B5);
+try
+    unique_(d);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+% Check the results.
+if t(1)
+    t(2) = isequal(d.time,e.time);
+    t(3) = isequal(d.freq,e.freq);
+end
+T = all(t);
+%@eof:2
diff --git a/src/@dates/uplus.m b/src/@dates/uplus.m
index 23bd48da0a7642fd2ebf0948460263c9038a4281..b185f438e1cadc158c3bf41db5864ab3d5296358 100644
--- a/src/@dates/uplus.m
+++ b/src/@dates/uplus.m
@@ -8,7 +8,7 @@ function o = uplus(o)  % --*-- Unitary tests --*--
 % OUTPUTS
 % - o [dates]
 
-% Copyright (C) 2013-2017 Dynare Team
+% Copyright © 2013-2020 Dynare Team
 %
 % This code is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -23,53 +23,79 @@ function o = uplus(o)  % --*-- Unitary tests --*--
 % You should have received a copy of the GNU General Public License
 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
 
+if o.freq==365
+    o.time(:,1) = o.time(:,1)+1;
+    return
+end
+
 o.time(:,2) = o.time(:,2)+1;
 idx = find(o.time(:,2)>o.freq); % Happy new year!
 o.time(idx,1) = o.time(idx,1)+1;
 o.time(idx,2) = 1;
 
+return
+
 %@test:1
-%$ % Define some dates
-%$ date_1 = '1950Y';
-%$ date_2 = '1950Q2';
-%$ date_3 = '1950Q4';
-%$ date_4 = '1950M2';
-%$ date_5 = '1950M12';
-%$
-%$ % Call the tested routine.
-%$ d1 = dates(date_1); +d1;
-%$ d2 = dates(date_2); +d2;
-%$ d3 = dates(date_3); +d3;
-%$ d4 = dates(date_4); +d4;
-%$ d5 = dates(date_5); +d5;
-%$ i1 = (d1==dates('1951Y'));
-%$ i2 = (d2==dates('1950Q3'));
-%$ i3 = (d3==dates('1951Q1'));
-%$ i4 = (d4==dates('1950M3'));
-%$ i5 = (d5==dates('1951M1'));
-%$
-%$ % Check the results.
-%$ t(1) = dassert(i1,true);
-%$ t(2) = dassert(i2,true);
-%$ t(3) = dassert(i3,true);
-%$ t(4) = dassert(i4,true);
-%$ t(5) = dassert(i5,true);
-%$ T = all(t);
+% Define some dates
+date_1 = '1950Y';
+date_2 = '1950Q2';
+date_3 = '1950Q4';
+date_4 = '1950M2';
+date_5 = '1950M12';
+
+% Call the tested routine.
+try
+    d1 = dates(date_1); +d1;
+    d2 = dates(date_2); +d2;
+    d3 = dates(date_3); +d3;
+    d4 = dates(date_4); +d4;
+    d5 = dates(date_5); +d5;
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    t(2) = (d1==dates('1951Y'));
+    t(3) = (d2==dates('1950Q3'));
+    t(4) = (d3==dates('1951Q1'));
+    t(5) = (d4==dates('1950M3'));
+    t(6) = (d5==dates('1951M1'));
+end
+
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ d1 = dates('1950Q1','1950Q2','1950Q3','1950Q4','1951Q1');
-%$ d2 = dates('1950Q2','1950Q3','1950Q4','1951Q1','1951Q2');
-%$ try
-%$   +d1;
-%$   t(1) = 1;
-%$ catch
-%$   t(1) = 0;
-%$ end
-%$
-%$ if t(1)
-%$   t(2) = dassert(all(d2==d1),true);
-%$ end
-%$
-%$ T = all(t);
-%@eof:2
\ No newline at end of file
+d1 = dates('1950Q1','1950Q2','1950Q3','1950Q4','1951Q1');
+d2 = dates('1950Q2','1950Q3','1950Q4','1951Q1','1951Q2');
+try
+  +d1;
+  t(1) = true;
+catch
+  t(1) = false;
+end
+
+if t(1)
+  t(2) = isequal(d2, d1);
+end
+
+T = all(t);
+%@eof:2
+
+%@test:3
+d1 = dates('2001-02-27','2001-02-28','2001-12-31');
+d2 = dates('2001-02-28','2001-03-01','2002-01-01');
+try
+  +d1;
+  t(1) = true;
+catch
+  t(1) = false;
+end
+
+if t(1)
+  t(2) = isequal(d2, d1);
+end
+
+T = all(t);
+%@eof:3
\ No newline at end of file
diff --git a/src/@dates/year.m b/src/@dates/year.m
index 9148435a052ffdab89349ba5d437ebed88056eac..d8f83a6fddcf545c417e09f63f835c0703e6be04 100644
--- a/src/@dates/year.m
+++ b/src/@dates/year.m
@@ -2,7 +2,7 @@ function y = year(d)
 
 % Returns the year.
 
-% Copyright (C) 2016-2017 Dynare Team
+% Copyright © 2016-2020 Dynare Team
 %
 % This code is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -17,4 +17,10 @@ function y = year(d)
 % You should have received a copy of the GNU General Public License
 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
 
+if d.freq==365
+    tmp = datevec(d.time(1));
+    y = tmp(1);
+    return
+end
+
 y = d.time(1);
\ No newline at end of file
diff --git a/src/@dseries/nanstd.m b/src/@dseries/nanstd.m
new file mode 100644
index 0000000000000000000000000000000000000000..10cb5ab248311e94674694c855f38186d2855e24
--- /dev/null
+++ b/src/@dseries/nanstd.m
@@ -0,0 +1,70 @@
+function s = nanstd(o, geometric) % --*-- Unitary tests --*--
+
+% Returns the standard deviation of the variables in a @dseries object o (robust
+% to the presence of NaNs).
+%
+% INPUTS
+% - o             dseries object [mandatory].
+% - geometric     logical [default is false], if true returns the geometric mean.
+%
+% OUTPUTS
+% - s             1*vobs(o) vector of doubles.
+
+% Copyright © 2020 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% Dynare is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
+
+if nargin<2
+    geometric = false;
+end
+
+s = NaN(1, o.vobs());
+
+if geometric
+    for i = 1:o.vobs()
+        tmp = o.data(~isnan(o.data(:,i)),i);
+        m = prod(tmp)^(1.0/length(tmp));
+        s(i) = exp(sqrt(sum(log(bsxfun(@rdivide, tmp, m)).^2, 1)/nobs(tmp)));
+    end
+else
+    for i=1:o.vobs()
+        tmp = o.data(~isnan(o.data(:,i)),i);
+        s(i) = std(tmp);
+    end
+end
+
+return
+%@test:1
+% Define a dataset.
+A = randn(1000000,2);
+A(3,1) = NaN;
+A(5,2) = NaN;
+
+% Instantiate a time series object and compute the mean.
+try
+   ts = dseries(A);
+   s = nanstd(ts);
+   t(1) = true;
+catch
+   t = false;
+end
+
+if t(1)
+   t(2) = dassert(isequal(size(s),[1, 2]), true);
+   t(3) = all(abs(s-ones(1, 2))<1e-3);
+end
+T = all(t);
+%@eof:1
\ No newline at end of file
diff --git a/src/@dseries/projection.m b/src/@dseries/projection.m
new file mode 100644
index 0000000000000000000000000000000000000000..6f42b75025c0239e3382e956bd43716ef1c118ca
--- /dev/null
+++ b/src/@dseries/projection.m
@@ -0,0 +1,93 @@
+function o = projection(o, info, periods)  % --*-- Unitary tests --*--
+
+% Projects variables in dseries object o.
+%
+% INPUTS
+% - o         [dseries]          Dataset.
+% - info      [cell]             n×3 array, with nobs(o)>=n, description of the paths.
+% - periods   [integer]          scalar, length of the projection path.
+%
+% OUTPUTS
+% - o         [dseries]          Updated dseries object.
+%
+% REMARKS
+% [1] Second input argument is a n×3 cell array. Each line provides
+%     informations necessary to project an endogenous or exogenous
+%     variable. The first column contain the name of variable (row char
+%     array). the second column contains the name of the method used to
+%     project the associated variable (row char array), possible values
+%     are 'Trend', 'Constant', and 'AR'. Last column provides
+%     quantitative information about the projection. If the second column
+%     value is 'Trend', the third column value is the growth factor of
+%     the (exponential) trend. If the second column value is 'Constant',
+%     the third column value is the level of the variable. If the second
+%     column value is 'AR', the third column value is the autoregressive
+%     parameter. The variables can be projected with an AR(p) model, if
+%     the third column contains a 1×p vector of doubles.
+% [2] The stationarity of the AR(p) model is not tested.
+% [3] The case of the constant projection, using the last value of the
+%     variable, is covered with 'Trend' and a growth factor equal to 1,
+%     or 'AR' with an autoregressive parameter equal to one (random walk).
+% [4] This projection routine only deals with exponential trends.
+
+% Fetch useful lines in info
+[~, ~, i2] = intersect(o.name, info(:,1), 'stable');
+INFO = info(i2,:);
+
+% Change number of periods in dseries object o
+T = nobs(o);
+o.data = cat(1, o.data, zeros(periods, vobs(o)));
+o.dates = [o.dates; o.dates(end)+1:o.dates(end)+periods];
+
+for i=1:rows(INFO)
+    j = find(strcmp(o.name, INFO{i,1}));
+    switch INFO{i,2}
+      case 'Constant'
+        if abs(INFO{i,3})>0
+            o.data(T+(1:periods),j) = INFO{i,3};
+        end
+      case 'Trend'
+        if abs(INFO{i,3}-1)>0
+            o.data(T+(1:periods),j) = o.data(T,j)*cumprod(INFO{i,3}^(1.0/frequency(o))*ones(periods,1));
+        else
+            o.data(T+(1:periods),j) = o.data(T,j)*ones(periods,1);
+        end
+      case 'AR'
+        if isequal(length(INFO{i,3}), 1)
+            if abs(INFO{i,3})>0
+                o.data(T+(1:periods),j) = o.data(T,j)*cumprod(INFO{i,3}*ones(periods,1));
+            end
+        else
+            p = length(INFO{i,3});
+            b = transpose(INFO{i,3}(:)); % Insure that the vector of autoregressive parameters is a row vector.
+            for t=T+1:T+periods
+                o.data(t,j) = b*o.data(t-(1:p),j);
+            end
+        end
+      otherwise
+        error('dseries::projection: Content of provided second argument (info) is not correct.')
+    end
+end
+
+return
+
+%@test:1
+try
+     data = ones(10,4);
+     ts = dseries(data, '1990Q1', {'A1', 'A2', 'A3', 'A4'});
+     info = {'A1', 'Trend', 1.2; 'A2', 'Constant', 0.0; 'A3', 'AR', .5; 'A4', 'AR', [.4, -.2]};
+     ts.projection(info, 10);
+     t(1) = true;
+ catch
+     t(1) = false;
+ end
+
+if t(1)
+    t(2) = isequal(ts.nobs(), 20);
+    t(3) = dassert(ts.A1.data(11), 1.046635139392, 1e-12) & dassert(ts.A1.data(14), 1.2, 1e-15);
+    t(4) = dassert(ts.A2.data(11:20), zeros(10,1), 1e-15);
+    t(5) = dassert(ts.A3.data(11), 0.5, 1e-15) & dassert(ts.A3.data(12), 0.25, 1e-15);
+    t(6) = dassert(ts.A4.data(11), 0.2, 1e-15) & dassert(ts.A4.data(12), 0.2*0.4-0.2, 1e-15);
+end
+T = all(t);
+%@eof:1
\ No newline at end of file
diff --git a/src/@dseries/rename_.m b/src/@dseries/rename_.m
index b239975f3ee1dc5f54c8f27cd973dab4945c8d1b..6fe310a5ed94de219c0b64bf4d5fa81a7420df0a 100644
--- a/src/@dseries/rename_.m
+++ b/src/@dseries/rename_.m
@@ -10,7 +10,7 @@ function o = rename_(o, old, new) % --*-- Unitary tests --*--
 % OUTPUTS
 % - o     [dseries]
 
-% Copyright (C) 2013-2017 Dynare Team
+% Copyright (C) 2013-2020 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -32,83 +32,125 @@ if isempty(o)
 end
 
 if nargin<3
-    if isequal(vobs(o), 1) || isequal(vobs(o), length(old))
-        new = old;
+    % old is new!
+    if ischar(old) && isequal(vobs(o), 1)
+        o.name = {old};
+    elseif iscellstr(old) && isequal(vobs(o), length(old))
+        o.name = old(:);
     else
-        error('dseries::rename: Missing argument!')
+        error('dseries::rename: Cannot rename variables (wrong input types or wrong dimensions).')
     end
-    if ~ischar(new) && ~(iscellstr(new) && isequal(vobs(o), length(new)))
-        error(['dseries::rename: Input argument ''' ...
-               inputname(2) ...
-               ''' has to be either a string or a cellstring that has the same number of entries as observed variables!'])
-    end
-    idname = 1;
+    return
 else
-    if ~ischar(old) || ~ischar(new)
-        error(['dseries::rename: Input arguments ''' inputname(2) ''' and ''' inputname(3) '''  have to be strings!'])
-    end
-    idname = find(strcmp(old,o.name));
-    if isempty(idname)
-        error(['dseries::rename: Variable ' old ' is unknown in dseries object ' inputname(1)  '!'])
+    if ischar(old) && ischar(new)
+        multi = false;
+        idname = find(strcmp(old, o.name));
+        if isempty(idname)
+            error('dseries::rename: Variable to be replaced (%s) is unknown', old)
+        end
+    elseif iscell(old) && iscell(new)
+        if isvector(old) && isvector(new)
+            if all(cellfun(@ischar, old)) && all(cellfun(@ischar, new)) && all(cellfun(@isrow, old)) && all(cellfun(@isrow, new))
+                if length(old)==length(new)
+                    multi = true;
+                    names = setdiff(old, o.name);
+                    names = sprintf('%s ', names{:});
+                    names = names(1:end-1);
+                    if ~isempty(names)
+                        names = sprintf('%s ', names{:});
+                        names = names(1:end-1);
+                        error('dseries::rename: Some variable (%s) to be replaced are unknown.', names)
+                    end
+                else
+                    error('dseries::rename: Input cell arrays must have the same number of elements.')
+                end
+            else
+                error('dseries::rename: Inputs must be cell of row char arrays.')
+            end
+        else
+            error('dseries::rename: Inputs must be one dimensional cell arrays.')
+        end
+    else
+        error('dseries::rename: Input arguments must be a pair of char arrays or a pair of cell arrays.')
     end
 end
 
-if iscellstr(new)
-    o.name = new(:);
+if multi
+    for i=1:length(old)
+        o.name(strcmp(old{i}, o.name)) = new(i);
+    end
 else
     o.name(idname) = {new};
 end
 
+return
+
 %@test:1
-%$ ts = dseries([transpose(1:5), transpose(6:10)],'1950q1',{'Output'; 'Consumption'}, {'Y_t'; 'C_t'});
-%$ try
-%$     ts.rename_('Output','Production');
-%$     t(1) = 1;
-%$ catch
-%$     t(1) = 0;
-%$ end
-%$
-%$ if t(1)>1
-%$     t(2) = dassert(ts.freq,4);
-%$     t(3) = dassert(ts.init.freq,4);
-%$     t(4) = dassert(ts.init.time,[1950, 1]);
-%$     t(5) = dassert(ts.vobs,2);
-%$     t(6) = dassert(ts.nobs,5);
-%$     t(7) = dassert(ts.name,{'Production'; 'Consumption'});
-%$     t(8) = dassert(ts.tex,{'Y_t'; 'C_t'});
-%$ end
-%$
-%$ T = all(t);
+ts = dseries([transpose(1:5), transpose(6:10)],'1950q1',{'Output'; 'Consumption'}, {'Y_t'; 'C_t'});
+try
+    ts.rename_('Output','Production');
+    t(1) = 1;
+catch
+    t(1) = 0;
+end
+
+if t(1)>1
+    t(2) = dassert(ts.freq,4);
+    t(3) = dassert(ts.init.freq,4);
+    t(4) = dassert(ts.init.time,[1950, 1]);
+    t(5) = dassert(ts.vobs,2);
+    t(6) = dassert(ts.nobs,5);
+    t(7) = dassert(ts.name,{'Production'; 'Consumption'});
+    t(8) = dassert(ts.tex,{'Y_t'; 'C_t'});
+end
+
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ ts = dseries(randn(10,1));
-%$ try
-%$     ts.rename_('Dora');
-%$     t(1) = 1;
-%$ catch
-%$     t(1) = 0;
-%$ end
-%$
-%$ if t(1)>1
-%$     t(2) = dassert(ts.name,{'Dora'});
-%$ end
-%$
-%$ T = all(t);
+ts = dseries(randn(10,1));
+try
+    ts.rename_('Dora');
+    t(1) = 1;
+catch
+    t(1) = 0;
+end
+
+if t(1)>1
+    t(2) = dassert(ts.name,{'Dora'});
+end
+
+T = all(t);
 %@eof:2
 
 %@test:3
-%$ ts = dseries(randn(10,3));
-%$ try
-%$     ts.rename_({'Dora', 'The', 'Explorer'});
-%$     t(1) = 1;
-%$ catch
-%$     t(1) = 0;
-%$ end
-%$
-%$ if t(1)
-%$     t(2) = dassert(ts.name, {'Dora'; 'The'; 'Explorer'});
-%$ end
-%$
-%$ T = all(t);
+ts = dseries(randn(10,3));
+try
+    ts.rename_({'Dora', 'The', 'Explorer'});
+    t(1) = 1;
+catch
+    t(1) = 0;
+end
+
+if t(1)
+    t(2) = dassert(ts.name, {'Dora'; 'The'; 'Explorer'});
+end
+
+T = all(t);
 %@eof:3
+
+%@test:4
+ts = dseries(randn(10,3), '1938Q4', {'Dora', 'The', 'Explorer'});
+try
+    ts.rename_({'Dora', 'The', 'Explorer'}, {'Make', 'my', 'day'});
+    t(1) = 1;
+catch
+    t(1) = 0;
+end
+
+if t(1)
+    t(2) = dassert(ts.name, {'Make'; 'my'; 'day'});
+end
+
+T = all(t);
+%@eof:4
diff --git a/src/@dseries/round.m b/src/@dseries/round.m
new file mode 100644
index 0000000000000000000000000000000000000000..430c0499535b67dd116e53ce0a00f0da650a8766
--- /dev/null
+++ b/src/@dseries/round.m
@@ -0,0 +1,51 @@
+function o = round(o, n) % --*-- Unitary tests --*--
+
+% Rounds to nearest decimal or integer.
+%
+% INPUTS
+% - o [dseries]
+% - n [integer]    scalar, number of decimals. Default is 0.
+%
+% OUTPUTS
+% - o [dseries]
+
+% Copyright (C) 2020 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% Dynare is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
+
+o = copy(o);
+o.round_(n);
+
+%@test:1
+%$ % Define a dates object
+%$ data = 1.23;
+%$ o = dseries(data);
+%$
+%$ % Call the tested routine.
+%$ try
+%$     p = o.round(1);
+%$     t(1) = true;
+%$ catch
+%$     t(1) = false;
+%$ end
+%$
+%$ if t(1)
+%$     t(2) = dassert(o.data, 1.23);
+%$     t(3) = dassert(p.data, 1.2);
+%$ end
+%$
+%$ T = all(t);
+%@eof:1
\ No newline at end of file
diff --git a/src/@dseries/round_.m b/src/@dseries/round_.m
new file mode 100644
index 0000000000000000000000000000000000000000..64944f299d5257ddf5f238134dd6c1156eb412c5
--- /dev/null
+++ b/src/@dseries/round_.m
@@ -0,0 +1,61 @@
+function o = round_(o, n) % --*-- Unitary tests --*--
+
+% Rounds to nearest decimal or integer.
+%
+% INPUTS
+% - o [dseries]
+% - n [integer]    scalar, number of decimals. Default is 0.
+%
+% OUTPUTS
+% - o [dseries]
+
+% Copyright (C) 2020 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% Dynare is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
+
+if nargin<2 || isempty(n)
+    n = 0;
+end
+
+for i=1:vobs(o)
+    if isempty(o.ops{i})
+        o.ops(i) = {['round(' o.name{i} ', ' int2str(n) ')']};
+    else
+        o.ops(i) = {['round(' o.ops{i} ', ' int2str(n) ')']};
+    end
+end
+
+o.data = round(o.data, n);
+
+%@test:1
+%$ % Define a dates object
+%$ data = 1.23;
+%$ o = dseries(data);
+%$
+%$ % Call the tested routine.
+%$ try
+%$     o.round_(1);
+%$     t(1) = true;
+%$ catch
+%$     t(1) = false;
+%$ end
+%$
+%$ if t(1)
+%$      t(2) = dassert(o.data, 1.2);
+%$ end
+%$
+%$ T = all(t);
+%@eof:1
\ No newline at end of file
diff --git a/src/@dseries/save.m b/src/@dseries/save.m
index a7520fd821eebd201f024d0cabafe4e2f8123c29..9a6c86bac03629d2a7b87aa82075b920a9cc3e51 100644
--- a/src/@dseries/save.m
+++ b/src/@dseries/save.m
@@ -122,6 +122,10 @@ switch format
         fprintf(fid, '%s%s\n',date2string(o.dates(t)), str);
     end
     fclose(fid);
+  case 'fame'
+    fame.write([basename '.db'], A);
+  otherwise
+    error('Unknown format!')
 end
 
 %@test:1
diff --git a/src/@dseries/subsref.m b/src/@dseries/subsref.m
index 62ffde82b3a3e22f61434ddc49a3a617b0a26b60..415d65a01396fec86b41400a9a13cc1c1456f65e 100644
--- a/src/@dseries/subsref.m
+++ b/src/@dseries/subsref.m
@@ -105,6 +105,7 @@ switch S(1).type
             'mean', ...
             'nanmean', ...
             'std', ...
+            'nanstd', ...
             'center','center_', ...
             'log','log_', ...
             'exp','exp_', ...
@@ -123,13 +124,16 @@ switch S(1).type
             'isnan', ...
             'isinf', ...
             'isreal', ...
+            'round', 'round_', ...
             'firstdate', ...
             'lastdate', ...
             'firstobservedperiod', ...
             'lastobservedperiod', ...
             'lineartrend', ...
             'resetops', 'resettags', ...
-            'subsample'}
+            'subsample', ...
+            'projection', ...
+            'timeaggregation'}
         if length(S)>1 && isequal(S(2).type,'()')
             if isempty(S(2).subs)
                 r = feval(S(1).subs,o);
@@ -216,7 +220,11 @@ switch S(1).type
             error(['dseries::subsref: Indices are out of bounds! Subsample cannot end after ' date2string(o.dates(end)) '.'])
         end
         % Extract a subsample using a dates object
-        [~,tdx] = intersect(o.dates.time,Dates.time,'rows');
+        if o.dates.freq==365
+            [~,tdx] = intersect(o.dates.time(:,1),Dates.time(:,1));
+        else
+            [~,tdx] = intersect(o.dates.time,Dates.time,'rows');
+        end
         r = copy(o);
         r.data = r.data(tdx,:);
         r.dates = r.dates(tdx);
diff --git a/src/@dseries/ydiff.m b/src/@dseries/ydiff.m
index 7c98aa756c04a7ffc9eefc017578c932ef350934..1e189fc45c80eadb9ffd994f5bf583edfdb2cb31 100644
--- a/src/@dseries/ydiff.m
+++ b/src/@dseries/ydiff.m
@@ -8,7 +8,7 @@ function o = ydiff(o) % --*-- Unitary tests --*--
 % OUTPUTS
 % - o   [dseries]
 
-% Copyright (C) 2012-2017 Dynare Team
+% Copyright © 2012-2020 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -28,24 +28,26 @@ function o = ydiff(o) % --*-- Unitary tests --*--
 o = copy(o);
 o.ydiff_();
 
+return
+
 %@test:1
-%$ try
-%$     data = transpose(1:100);
-%$     ts = dseries(data,'1950Q1',{'A1'},{'A_1'});
-%$     ds = ts.ydiff();
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$
-%$ if t(1)
-%$     DATA = NaN(4,ts.vobs);
-%$     DATA = [DATA; 4*ones(ts.nobs-4,ts.vobs)];
-%$     t(2) = dassert(ds.data,DATA);
-%$     t(3) = dassert(ds.ops{1},['ydiff(A1)']);
-%$     t(4) = dassert(ts.data, data);
-%$ end
-%$
-%$ T = all(t);
+try
+    data = transpose(1:100);
+    ts = dseries(data,'1950Q1',{'A1'},{'A_1'});
+    ds = ts.ydiff();
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+
+if t(1)
+    DATA = NaN(4,ts.vobs);
+    DATA = [DATA; 4*ones(ts.nobs-4,ts.vobs)];
+    t(2) = dassert(ds.data,DATA);
+    t(3) = dassert(ds.ops{1},['ydiff(A1)']);
+    t(4) = dassert(ts.data, data);
+end
+
+T = all(t);
 %@eof:1
\ No newline at end of file
diff --git a/src/@dseries/ydiff_.m b/src/@dseries/ydiff_.m
index 796130cdc1b1fbf7b4386105f2c41b9bb6e4cf15..647f1b0288cf52ee7cfcb8530edd5cd7d303932b 100644
--- a/src/@dseries/ydiff_.m
+++ b/src/@dseries/ydiff_.m
@@ -8,7 +8,7 @@ function o = ydiff_(o) % --*-- Unitary tests --*--
 % OUTPUTS
 % - o   [dseries]
 
-% Copyright (C) 2012-2020 Dynare Team
+% Copyright © 2012-2020 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -56,125 +56,107 @@ for i = 1:vobs(o)
     end
 end
 
+return
+
 %@test:1
-%$ try
-%$     data = transpose(1:100);
-%$     ts = dseries(data,'1950Q1',{'A1'},{'A_1'});
-%$     ts.ydiff_;
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$
-%$ if t(1)
-%$     DATA = NaN(4,ts.vobs);
-%$     DATA = [DATA; 4*ones(ts.nobs-4,ts.vobs)];
-%$     t(2) = dassert(ts.data,DATA);
-%$     t(3) = dassert(ts.ops{1},['ydiff(A1)']);
-%$ end
-%$
-%$ T = all(t);
+try
+    data = transpose(1:100);
+    ts = dseries(data,'1950Q1',{'A1'},{'A_1'});
+    ts.ydiff_;
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+
+if t(1)
+    DATA = NaN(4,ts.vobs);
+    DATA = [DATA; 4*ones(ts.nobs-4,ts.vobs)];
+    t(2) = dassert(ts.data,DATA);
+    t(3) = dassert(ts.ops{1},['ydiff(A1)']);
+end
+
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ try
-%$     data = transpose(1:100);
-%$     ts = dseries(data,'1950M1',{'A1'},{'A_1'});
-%$     ts.ydiff_;
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$
-%$ if t(1)
-%$     DATA = NaN(12,ts.vobs);
-%$     DATA = [DATA; 12*ones(ts.nobs-12,ts.vobs)];
-%$     t(2) = dassert(ts.data,DATA);
-%$     t(3) = dassert(ts.ops{1},['ydiff(A1)']);
-%$ end
-%$
-%$ T = all(t);
+try
+    data = transpose(1:100);
+    ts = dseries(data,'1950M1',{'A1'},{'A_1'});
+    ts.ydiff_;
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+
+if t(1)
+    DATA = NaN(12,ts.vobs);
+    DATA = [DATA; 12*ones(ts.nobs-12,ts.vobs)];
+    t(2) = dassert(ts.data,DATA);
+    t(3) = dassert(ts.ops{1},['ydiff(A1)']);
+end
+
+T = all(t);
 %@eof:2
 
 %@test:3
-%$ try
-%$     data = transpose(1:100);
-%$     ts = dseries(data,'1950W1',{'A1'},{'A_1'});
-%$     ts.ydiff_;
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ if t(1)
-%$     DATA = NaN(52,ts.vobs);
-%$     DATA = [DATA; 52*ones(ts.nobs-52,ts.vobs)];
-%$     t(2) = dassert(ts.data,DATA);
-%$     t(3) = dassert(ts.ops{1},['ydiff(A1)']);
-%$ end
-%$
-%$ T = all(t);
+try
+    data = transpose(1:100);
+    ts = dseries(data,'1950Y',{'A1'},{'A_1'});
+    ts.ydiff_;
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+
+if t(1)
+    DATA = NaN(1,ts.vobs);
+    DATA = [DATA; ones(ts.nobs-1,ts.vobs)];
+    t(2) = dassert(ts.data,DATA);
+    t(3) = dassert(ts.ops{1},['ydiff(A1)']);
+end
+
+T = all(t);
 %@eof:3
 
 %@test:4
-%$ try
-%$     data = transpose(1:100);
-%$     ts = dseries(data,'1950Y',{'A1'},{'A_1'});
-%$     ts.ydiff_;
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$
-%$ if t(1)
-%$     DATA = NaN(1,ts.vobs);
-%$     DATA = [DATA; ones(ts.nobs-1,ts.vobs)];
-%$     t(2) = dassert(ts.data,DATA);
-%$     t(3) = dassert(ts.ops{1},['ydiff(A1)']);
-%$ end
-%$
-%$ T = all(t);
-%@eof:4
-
-%@test:5
-%$ try
-%$     data = transpose(1:100);
-%$     ts = dseries(data,'1950H1',{'A1'},{'A_1'});
-%$     ts.ydiff_;
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ if t(1)
-%$     DATA = NaN(2,ts.vobs);
-%$     DATA = [DATA; 2*ones(ts.nobs-2,ts.vobs)];
-%$     t(2) = dassert(ts.data,DATA);
-%$     t(3) = dassert(ts.ops{1},['ydiff(A1)']);
-%$ end
-%$
-%$ T = all(t);
+try
+    data = transpose(1:100);
+    ts = dseries(data,'1950H1',{'A1'},{'A_1'});
+    ts.ydiff_;
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    DATA = NaN(2,ts.vobs);
+    DATA = [DATA; 2*ones(ts.nobs-2,ts.vobs)];
+    t(2) = dassert(ts.data,DATA);
+    t(3) = dassert(ts.ops{1},['ydiff(A1)']);
+end
+
+T = all(t);
 %@eof:5
 
 %@test:6
-%$ try
-%$     data = transpose(1:1095);
-%$     ts = dseries(data,'1950-01-01',{'A1'},{'A_1'});
-%$     ts.ydiff_;
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ if t(1)
-%$     DATA = NaN(365,ts.vobs);
-%$     DATA = [DATA; 365*ones(ts.nobs-365,ts.vobs)];
-%$     t(2) = dassert(ts.data,DATA);
-%$     t(3) = dassert(ts.ops{1},['ydiff(A1)']);
-%$ end
-%$
-%$ T = all(t);
+try
+    data = transpose(1:1095);
+    ts = dseries(data,'1950-01-01',{'A1'},{'A_1'});
+    ts.ydiff_;
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    DATA = NaN(365,ts.vobs);
+    DATA = [DATA; 365*ones(ts.nobs-365,ts.vobs)];
+    t(2) = dassert(ts.data,DATA);
+    t(3) = dassert(ts.ops{1},['ydiff(A1)']);
+end
+
+T = all(t);
 %@eof:6
\ No newline at end of file
diff --git a/src/@dseries/ygrowth_.m b/src/@dseries/ygrowth_.m
index ce9c089c7522d0b08d501cee80153179d369a22c..6663ad258bfea5ae81a71e10e973b171a03ef984 100644
--- a/src/@dseries/ygrowth_.m
+++ b/src/@dseries/ygrowth_.m
@@ -8,7 +8,7 @@ function o = ygrowth_(o) % --*-- Unitary tests --*--
 % OUTPUTS
 % - o   [dseries]
 
-% Copyright (C) 2012-2020 Dynare Team
+% Copyright © 2012-2020 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -56,101 +56,83 @@ for i = 1:vobs(o)
     end
 end
 
+return
+
 %@test:1
-%$ try
-%$     data = repmat(transpose(1:2),100,1);
-%$     ts = dseries(data,'1950H1');
-%$     ts.ygrowth_;
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$
-%$ if t(1)
-%$     DATA = NaN(2,ts.vobs);
-%$     DATA = [DATA; zeros(ts.nobs-2,ts.vobs)];
-%$     t(2) = dassert(ts.data,DATA);
-%$ end
-%$
-%$ T = all(t);
+try
+    data = repmat(transpose(1:2),100,1);
+    ts = dseries(data,'1950H1');
+    ts.ygrowth_;
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+
+if t(1)
+    DATA = NaN(2,ts.vobs);
+    DATA = [DATA; zeros(ts.nobs-2,ts.vobs)];
+    t(2) = dassert(ts.data,DATA);
+end
+
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ try
-%$     data = repmat(transpose(1:4),100,1);
-%$     ts = dseries(data,'1950Q1');
-%$     ts.ygrowth_;
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$
-%$ if t(1)
-%$     DATA = NaN(4,ts.vobs);
-%$     DATA = [DATA; zeros(ts.nobs-4,ts.vobs)];
-%$     t(2) = dassert(ts.data,DATA);
-%$ end
-%$
-%$ T = all(t);
+try
+    data = repmat(transpose(1:4),100,1);
+    ts = dseries(data,'1950Q1');
+    ts.ygrowth_;
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+
+if t(1)
+    DATA = NaN(4,ts.vobs);
+    DATA = [DATA; zeros(ts.nobs-4,ts.vobs)];
+    t(2) = dassert(ts.data,DATA);
+end
+
+T = all(t);
 %@eof:2
 
 %@test:3
-%$ try
-%$     data = repmat(transpose(1:12),100,1);
-%$     ts = dseries(data,'1950M1');
-%$     ts.ygrowth_();
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ if t(1)
-%$     DATA = NaN(12,ts.vobs);
-%$     DATA = [DATA; zeros(ts.nobs-12,ts.vobs)];
-%$     t(2) = dassert(ts.data,DATA);
-%$ end
-%$
-%$ T = all(t);
-%@eof:3
+try
+    data = repmat(transpose(1:12),100,1);
+    ts = dseries(data,'1950M1');
+    ts.ygrowth_();
+    t(1) = true;
+catch
+    t(1) = false;
+end
 
-%@test:4
-%$ try
-%$     data = repmat(transpose(1:52),100,1);
-%$     ts = dseries(data,'1950W1');
-%$     ts.ygrowth_();
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$
-%$ if t(1)
-%$     DATA = NaN(52,ts.vobs);
-%$     DATA = [DATA; zeros(ts.nobs-52,ts.vobs)];
-%$     t(2) = dassert(ts.data,DATA);
-%$ end
-%$
-%$ T = all(t);
-%@eof:4
+if t(1)
+    DATA = NaN(12,ts.vobs);
+    DATA = [DATA; zeros(ts.nobs-12,ts.vobs)];
+    t(2) = dassert(ts.data,DATA);
+end
+
+T = all(t);
+%@eof:3
 
 %@test:5
-%$ try
-%$     data = repmat(transpose(1:365),100,1);
-%$     ts = dseries(data,'1950-01-01');
-%$     ts.ygrowth_();
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$
-%$ if t(1)
-%$     DATA = NaN(365,ts.vobs);
-%$     DATA = [DATA; zeros(ts.nobs-365,ts.vobs)];
-%$     t(2) = dassert(ts.data,DATA);
-%$ end
-%$
-%$ T = all(t);
-%@eof:5
+try
+    data = repmat(transpose(1:365),100,1);
+    ts = dseries(data,'1950-01-01');
+    ts.ygrowth_();
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+
+if t(1)
+    DATA = NaN(365,ts.vobs);
+    DATA = [DATA; zeros(ts.nobs-365,ts.vobs)];
+    t(2) = dassert(ts.data,DATA);
+end
+
+T = all(t);
+%@eof:5
\ No newline at end of file
diff --git a/src/initialize_dseries_class.m b/src/initialize_dseries_class.m
index 3154d634105cc5481e795104a5c1cfe666965993..c445ae189ea81803c3dd96443a2f81537bd926db 100644
--- a/src/initialize_dseries_class.m
+++ b/src/initialize_dseries_class.m
@@ -37,6 +37,7 @@ p = {'mdbnomics2dseries'; ...
      'utilities/variables'; ...
      'utilities/cumulate'; ...
      'utilities/struct'; ...
+     'utilities/misc'; ...
      'utilities/x13'};
 
 % Add missing routines if dynare is not in the path
diff --git a/src/modules/matlab-fame-io b/src/modules/matlab-fame-io
new file mode 160000
index 0000000000000000000000000000000000000000..f0a61644d6dcb72d9f2801d37abb8b58670b5bde
--- /dev/null
+++ b/src/modules/matlab-fame-io
@@ -0,0 +1 @@
+Subproject commit f0a61644d6dcb72d9f2801d37abb8b58670b5bde
diff --git a/src/read/load_data.m b/src/read/load_data.m
index 9e7d8cb5bd97e3ff1ada8c60ef3cbce222ec1048..a1eeeaa776ddd686d7a81f571c80d2c031c78f4a 100644
--- a/src/read/load_data.m
+++ b/src/read/load_data.m
@@ -50,6 +50,16 @@ elseif check_file_extension(filename,'xls') || check_file_extension(filename,'xl
     tex = [];
     ops = cell(length(varlist), 1);
     tags = struct();
+elseif check_file_extension(filename,'db')
+    % Fame database (need to have matlab-fame-io submodule and TimeIQ installed)
+    FameInfo = fame.open.connector();
+    db = fame.open.database(FameInfo, filename);
+    [data, init, varlist] = fame.getall.timeseries(db);
+    fame.close.database(db);
+    fame.close.connector(FameInfo);
+    tex = [];
+    ops = cell(length(varlist), 1);
+    tags = struct();
 else
     error('dseries:WrongInputArguments', 'I''m not able to load data from %s!', filename);
 end
diff --git a/src/utilities/convert/date2string.m b/src/utilities/convert/date2string.m
index 9a94a8030ff6fa251d3bfbe39ab1131bf4afef64..a34b595c3c34cdfa046e9dbe775b03cafd53de05 100644
--- a/src/utilities/convert/date2string.m
+++ b/src/utilities/convert/date2string.m
@@ -3,14 +3,14 @@ function s = date2string(varargin) % --*-- Unitary tests --*--
 % Returns date as a string.
 %
 % INPUTS
-%  o varargin{1}     + dates object with one element, if nargin==1.
-%                    + 1*3 vector of integers (first element is the year, second and third elements are the subperiods), if nargin==3.
-%  o varargin{2}     integer scalar equal to 1, 2, 4, 12, 52 or 365 (frequency).
+% - varargin{1}     [dates]       scalar, if nargin==1.
+%                   [integer]     1×2 array, if nargin==2.
+% - varargin{2}     [integer]     scalar, frequency (1, 2, 4, 12, or 365).
 %
 % OUTPUTS
-%  o s               string.
+% - s               [char]        1×n array.
 
-% Copyright (C) 2013-2020 Dynare Team
+% Copyright © 2013-2020 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -27,8 +27,8 @@ function s = date2string(varargin) % --*-- Unitary tests --*--
 % You should have received a copy of the GNU General Public License
 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
 
-if isequal(nargin,1)
-    if ~(isa(varargin{1},'dates') && isequal(length(varargin{1}),1))
+if isequal(nargin, 1)
+    if ~(isa(varargin{1}, 'dates') && isequal(length(varargin{1}), 1))
         error(['dates::format: Input argument ' inputname(1) ' has to be a dates object with one element!'])
     else
         time = varargin{1}.time;
@@ -36,20 +36,24 @@ if isequal(nargin,1)
     end
 end
 
-if isequal(nargin,2)
-    if ~(isvector(varargin{1}) && (isequal(length(varargin{1}),2) || isequal(length(varargin{1}),3)) && all(isint(varargin{1})) && isscalar(varargin{2} && ismember(varargin{2},[1 2 4 12 52 365])))
-        error(['dates::format: First input must be a 1*2 or 1*3 vector of integers and second input must be a scalar integer (1, 2, 4, 12, 52 or 365)!'])
-    else
-        if varargin{1}(2)>varargin{2} || varargin{1}(2)<1
-            error('dates::format: Second element of the first input be between 1 and %s!',num2str(varargin{2}))
+if isequal(nargin, 2)
+    if ~isscalar(varargin{2}) || ~isint(varargin{2}) || ~ismember(varargin{2}, [1 2 4 12 365])
+        error('Second input argument must be an integer scalar equal to 1, 2, 4, 12, or 365 (frequency).')
+    end
+    freq = varargin{2};
+    if ~isnumeric(varargin{1}) || ~isrow(varargin{1}) || ~all(isint(varargin{1}(~isnan(varargin{1})))) || ~isequal(length(varargin{1}), 2)
+        error('First input must be a 1*2 array of integers.')
+    end
+    if ~isequal(varargin{2}, 365)
+        if any(varargin{1}(:,2)<1) || any(varargin{1}(:,2)>varargin{2})
+            error('Second input has elements non admissible as dates.')
         end
-        time = varargin{1};
-        freq = varargin{2};
     end
+    time = varargin{1};
 end
 
-if freq == 365
-    s = [num2str(time(1),'%02d') '-' num2str(time(2),'%02d') '-' num2str(time(3),'%02d')];
+if freq==365
+    s = datestr(time(1), 'yyyy-mm-dd');
 else
     s = [num2str(time(1)) freq2string(freq)];
     if freq>1
@@ -57,99 +61,86 @@ else
     end
 end
 
+return
+
 %@test:1
-%$ try
-%$     str = date2string(dates('1938Q4'));
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ if t(1)
-%$     t(2) = dassert(str, '1938Q4');
-%$ end
-%$
-%$ T = all(t);
+try
+    str = date2string(dates('1938Q4'));
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    t(2) = isequal(str, '1938Q4');
+end
+
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ try
-%$     str = date2string(dates('1938Q4','1945Q3'));
-%$     t(1) = false;
-%$ catch
-%$     t(1) = true;
-%$ end
-%$
-%$ T = all(t);
+try
+    str = date2string(dates('1938Q4','1945Q3'));
+    t(1) = false;
+catch
+    t(1) = true;
+end
+
+T = all(t);
 %@eof:2
 
 %@test:3
-%$ try
-%$     str = date2string([1938, 11], 12);
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ if t(1)
-%$     t(2) = dassert(str, '1938M11');
-%$ end
-%$
-%$ T = all(t);
+try
+    str = date2string([1938, 11], 12);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    t(2) = isequal(str, '1938M11');
+end
+
+T = all(t);
 %@eof:3
 
 %@test:4
-%$ try
-%$     str = date2string([1938; 11], 12);
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ if t(1)
-%$     t(2) = dassert(str, '1938M11');
-%$ end
-%$
-%$ T = all(t);
+try
+    str = date2string([1938, 11], 4);
+    t(1) = false;
+catch
+    t(1) = true;
+end
+
+T = all(t);
 %@eof:4
 
 %@test:5
-%$ try
-%$     str = date2string([1938; 11], 4);
-%$     t(1) = false;
-%$ catch
-%$     t(1) = true;
-%$ end
-%$
-%$ T = all(t);
+try
+    str = date2string([1938, 2], 2);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    t(2) = isequal(str, '1938H2');
+end
+
+T = all(t);
 %@eof:5
 
 %@test:6
-%$ try
-%$     str = date2string([1938; 2], 2);
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ if t(1)
-%$     t(2) = dassert(str, '1938H2');
-%$ end
-%$
-%$ T = all(t);
-%@eof:6
-
-%@test:7
-%$ try
-%$     str = date2string([1938; 1; 12], 365);
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ if t(1)
-%$     t(2) = dassert(str, '1938-01-12');
-%$ end
-%$
-%$ T = all(t);
-%@eof:7
+try
+    str = date2string([707852, NaN], 365);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    t(2) = isequal(str, '1938-01-12');
+end
+
+T = all(t);
+%@eof:6
\ No newline at end of file
diff --git a/src/utilities/convert/dates2M.m b/src/utilities/convert/dates2M.m
new file mode 100644
index 0000000000000000000000000000000000000000..91ce7f3e4f882e039d0a4b529b21373179dcd64c
--- /dev/null
+++ b/src/utilities/convert/dates2M.m
@@ -0,0 +1,33 @@
+function m = dates2M(d)
+
+% INPUTS
+% - d   [dates]    daily frequency object with n elements.
+%
+% OUTPUTS
+% - m   [dates]    monthly frequency object with n elements (with repetitions).
+
+% Copyright © 2020 Dynare Team
+%
+% This code is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% Dynare dates submodule is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
+
+if d.freq==365
+    time = datevec(d.time(:,1));
+elseif d.freq==12
+    m = d;
+    return
+else
+    error('Cannot convert to higher frequency.')
+end
+
+m = dates(12, time(:,1:2));
\ No newline at end of file
diff --git a/src/utilities/convert/dates2Q.m b/src/utilities/convert/dates2Q.m
new file mode 100644
index 0000000000000000000000000000000000000000..7414cccd4e5d36dc6c70927e140ccf2a138940ba
--- /dev/null
+++ b/src/utilities/convert/dates2Q.m
@@ -0,0 +1,45 @@
+function m = dates2Q(d)
+
+% INPUTS
+% - d   [dates]    daily frequency object with n elements.
+%
+% OUTPUTS
+% - q   [dates]    quaterly frequency object with n elements (with repetitions).
+
+% Copyright © 2020 Dynare Team
+%
+% This code is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% Dynare dates submodule is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
+
+if d.freq==365
+    time = datevec(d.time(:,1));
+elseif d.freq==12
+    time = d.time;
+elseif d.freq==4
+    m = d;
+    return
+else
+    error('Cannot convert to higher frequency.')
+end
+
+isq1 = arrayfun( @(m) ismember(m, [1, 2, 3]), time(:,2));
+isq2 = arrayfun( @(m) ismember(m, [4, 5, 6]), time(:,2));
+isq3 = arrayfun( @(m) ismember(m, [7, 8, 9]), time(:,2));
+isq4 = arrayfun( @(m) ismember(m, [10, 11, 12]), time(:,2));
+
+time(isq1,2) = 1;
+time(isq2,2) = 2;
+time(isq3,2) = 3;
+time(isq4,2) = 4;
+
+m = dates(4, time(:,1:2));
\ No newline at end of file
diff --git a/src/utilities/convert/dates2Y.m b/src/utilities/convert/dates2Y.m
new file mode 100644
index 0000000000000000000000000000000000000000..848b1117ef173c5f3e6699f044e8ebb1f028e15f
--- /dev/null
+++ b/src/utilities/convert/dates2Y.m
@@ -0,0 +1,35 @@
+function y = dates2Y(d)
+
+% INPUTS
+% - d   [dates]    daily frequency object with n elements.
+%
+% OUTPUTS
+% - y   [dates]    annual frequency object with n elements (with repetitions).
+
+% Copyright © 2020 Dynare Team
+%
+% This code is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% Dynare dates submodule is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
+
+if d.freq==365
+    time = datevec(d.time(:,1));
+elseif d.freq==12 || d.freq==4
+    time = d.time;
+elseif d.freq==1
+    y = d;
+    return
+else
+    error('Unknown frequency.')
+end
+
+y = dates(1, time(:,1));
\ No newline at end of file
diff --git a/src/utilities/convert/dseries2M.m b/src/utilities/convert/dseries2M.m
new file mode 100644
index 0000000000000000000000000000000000000000..9b3768f2b71a2baf38ea31ba992a03000045ecc1
--- /dev/null
+++ b/src/utilities/convert/dseries2M.m
@@ -0,0 +1,102 @@
+function ts = dseries2M(ds, method)
+
+% INPUTS
+% - ds       [dseries]    daily frequency object with n elements.
+% - method   [char]       1×m array, method used for the time aggregation, possible values are:
+%                            - 'arithmetic-average' (for rates),
+%                            - 'geometric-average' (for factors),
+%                            - 'sum' (for flow variables), and
+%                            - 'end-of-period' (for stock variables).
+%
+% OUTPUTS
+% - ts       [dseries]    monthly frequency object with m<n elements.
+
+% Copyright © 2020 Dynare Team
+%
+% This code is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% Dynare dates submodule is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
+
+    dm = dates2M(ds.dates);
+    dM = unique(dm); % dM.ndat will be the maximum number of periods in ts
+
+    tdata = NaN(dM.ndat, ds.vobs);
+
+    switch method
+      case 'arithmetic-average'
+        for i=1:dM.ndat
+            idm = find(dm==dM(i));
+            tdata(i,:) = mean(ds.data(idm,:));
+            if ~isalldays(dM(i), idm)
+                warning('Not all days are available in month %s.', date2string(dM(i)))
+            end
+        end
+      case 'geometric-average'
+        for i=1:dM.ndat
+            idm = find(dm==dM(i));
+            tdata(i,:) = prod(ds.data(idm,:), 1).^(1/length(idm));
+            if ~isalldays(dM(i), idm)
+                warning('Not all days are available in month %s.', date2string(dM(i)))
+            end
+        end
+      case 'sum'
+        for i=1:dM.ndat
+            idm = find(dm==dM(i));
+            tdata(i,:) = sum(ds.data(idm,:), 1);
+            if ~isalldays(dM(i), idm)
+                warning('Not all days are available in month %s.', date2string(dM(i)))
+            end
+        end
+      case 'end-of-period'
+        for i=1:dM.ndat
+            idm = find(dm==dM(i));
+            lastday = datevec(ds.dates.time(idm(end)));
+            tdata(i,:) = ds.data(idm(end),:);
+            if lastday(3)<expectedlastday(dM(i))
+                warning('The last available day is not the last observed day of %s.', date2string(dM(i)))
+            end
+        end
+      otherwise
+        error('Unknow method.')
+    end
+
+    ts = dseries(tdata, dM, ds.name, ds.tex);
+
+end
+
+function eld = expectedlastday(m)
+    if ismember(m.time(2), [4,6,9,11])
+        eld = 30;
+    elseif ismember(m.time(2), [1,3,5,7,8,10,12])
+        eld = 31;
+    else % February
+        if isleapyear(m.time(1))
+            eld = 29;
+        else
+            eld = 28;
+        end
+    end
+end
+
+function iad = isalldays(m, id)
+    if ismember(m.time(2), [4,6,9,11])
+        iad = length(id)==30;
+    elseif ismember(m.time(2), [1,3,5,7,8,10,12])
+        iad = length(id)==31;
+    else % February
+        if isleapyear(m.time(1))
+            iad = length(id)==29;
+        else
+            iad = length(id)==28;
+        end
+    end
+end
\ No newline at end of file
diff --git a/src/utilities/convert/dseries2Q.m b/src/utilities/convert/dseries2Q.m
new file mode 100644
index 0000000000000000000000000000000000000000..0e05bacae9a30efd8fba5b4e623ba8d05100d8c6
--- /dev/null
+++ b/src/utilities/convert/dseries2Q.m
@@ -0,0 +1,127 @@
+function ts = dseries2Q(ds, method)
+
+% INPUTS
+% - ds       [dseries]    daily or monthly frequency object with n elements.
+% - method   [char]       1×m array, method used for the time aggregation, possible values are:
+%                            - 'arithmetic-average' (for rates),
+%                            - 'geometric-average' (for factors),
+%                            - 'sum' (for flow variables), and
+%                            - 'end-of-period' (for stock variables).
+%
+% OUTPUTS
+% - ts       [dseries]    quaterly frequency object with m<n elements.
+
+% Copyright © 2020 Dynare Team
+%
+% This code is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% Dynare dates submodule is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
+
+    dq = dates2Q(ds.dates);
+    dQ = unique(dq); % dQ.ndat will be the maximum number of periods in ts
+
+    tdata = NaN(dQ.ndat, ds.vobs);
+
+    switch method
+      case 'arithmetic-average'
+        for i=1:dQ.ndat
+            idq = find(dq==dQ(i));
+            tdata(i,:) = mean(ds.data(idq,:));
+            if ds.dates.freq==365 && ~isalldays(dQ(i), idq)
+                warning('Not all days are available in %s.', date2string(dQ(i)))
+            end
+            if ds.dates.freq==12 && ~isequal(length(idq), 3)
+                warning('Not all months are available in %s.', date2string(dQ(i)))
+            end
+        end
+      case 'geometric-average'
+        for i=1:dQ.ndat
+            idq = find(dq==dQ(i));
+            tdata(i,:) = prod(ds.data(idq,:), 1).^(1/length(idq));
+            if ds.dates.freq==365 && ~isalldays(dQ(i), idq)
+                warning('Not all days are available in %s.', date2string(dQ(i)))
+            end
+            if ds.dates.freq==12 && ~isequal(length(idq), 3)
+                warning('Not all months are available in %s.', date2string(dQ(i)))
+            end
+        end
+      case 'sum'
+        for i=1:dQ.ndat
+            idq = find(dq==dQ(i));
+            tdata(i,:) = sum(ds.data(idq,:), 1);
+            if ds.dates.freq==365 && ~isalldays(dQ(i), idq)
+                warning('Not all days are available in %s.', date2string(dQ(i)))
+            end
+            if ds.dates.freq==12 && ~isequal(length(idq), 3)
+                warning('Not all months are available in %s.', date2string(dQ(i)))
+            end
+        end
+      case 'end-of-period'
+        for i=1:dQ.ndat
+            idq = find(dq==dQ(i));
+            tdata(i,:) = ds.data(idq(end),:);
+            if ds.dates.freq==365
+                lastday = datevec(ds.dates.time(idq(end)));
+                if lastday(3)<expectedlastday(dQ(i))
+                    warning('The last available day is not the last observed day of %s.', date2string(dQ(i)))
+                end
+            end
+            if ds.dates.freq==12
+                lastmonth = ds.dates.time(idq(end), 2);
+                if lastmonth<expectedlastmonth(dQ(i))
+                    warning('The last available day is not the last observed day of %s.', date2string(dQ(i)))
+                end
+            end
+        end
+      otherwise
+        error('Unknow method.')
+    end
+
+    ts = dseries(tdata, dQ, ds.name, ds.tex);
+
+end
+
+function eld = expectedlastday(q)
+    if ismember(q.time(2), [1,4])
+        eld = 31; % last day of March or December
+    else
+        eld = 30; % last day of June or September
+    end
+end
+
+function elm = expectedlastmonth(q)
+    switch q.time(2)
+      case 1
+        elm = 3;
+      case 2
+        elm = 6;
+      case 3
+        elm = 9;
+      case 4
+        elm = 12;
+      otherwise
+    end
+end
+
+function iad = isalldays(m, id)
+    if ismember(m.time(2), [3, 4])
+        iad = length(id)==92;
+    elseif m.time(2)==2
+        iad = length(id)==91;
+    else % contains February
+        if isleapyear(m.time(1))
+            iad = length(id)==91;
+        else
+            iad = length(id)==90;
+        end
+    end
+end
\ No newline at end of file
diff --git a/src/utilities/convert/freq2string.m b/src/utilities/convert/freq2string.m
index fe622e34650acd4be3e3e2bf4cda93daa4918b06..428b1a6050fe1fbbe325602d6c7b857069a5ba9e 100644
--- a/src/utilities/convert/freq2string.m
+++ b/src/utilities/convert/freq2string.m
@@ -1,12 +1,12 @@
 function s = freq2string(freq) % --*-- Unitary tests --*--
 
 % INPUTS
-%  o freq     scalar integer,  equal to 1, 2, 4, 12, 52 or 365 (resp. annual, bi-annual, quaterly, monthly, weekly or daily)
+% - freq  [integer]   scalar equal to 1, 2, 4, 12, or 365 (resp. annual, bi-annual, quaterly, monthly, or daily)
 %
 % OUTPUTS
-%  o s        character, equal to Y, H, Q, M, W or D (resp. annual, bi-annual, quaterly, monthly, weekly or daily)
+% - s     [char]      scalar equal to Y, H, Q, M, or D (resp. annual, bi-annual, quaterly, monthly, or daily)
 
-% Copyright (C) 2013-2020 Dynare Team
+% Copyright © 2013-2020 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -32,46 +32,44 @@ switch freq
     s = 'Q';
   case 12
     s = 'M';
-  case 52
-    s = 'W';
   case 365
     s = 'D';
   otherwise
     error('dates::freq2string: Unknown frequency!')
 end
 
+return
+
 %@test:1
-%$ try
-%$     strY = freq2string(1);
-%$     strH = freq2string(2);
-%$     strQ = freq2string(4);
-%$     strM = freq2string(12);
-%$     strW = freq2string(52);
-%$     strD = freq2string(365);
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ if t(1)
-%$     t(2) = dassert(strY, 'Y');
-%$     t(3) = dassert(strH, 'H');
-%$     t(4) = dassert(strQ, 'Q');
-%$     t(5) = dassert(strM, 'M');
-%$     t(6) = dassert(strW, 'W');
-%$     t(7) = dassert(strD, 'D');
-%$ end
-%$
-%$ T = all(t);
+try
+    strY = freq2string(1);
+    strH = freq2string(2);
+    strQ = freq2string(4);
+    strM = freq2string(12);
+    strD = freq2string(365);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    t(2) = isequal(strY, 'Y');
+    t(3) = isequal(strH, 'H');
+    t(4) = isequal(strQ, 'Q');
+    t(5) = isequal(strM, 'M');
+    t(6) = isequal(strD, 'D');
+end
+
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ try
-%$     str = freq2string(13);
-%$     t(1) = false;
-%$ catch
-%$     t(1) = true;
-%$ end
-%$
-%$ T = all(t);
+try
+    str = freq2string(13);
+    t(1) = false;
+catch
+    t(1) = true;
+end
+
+T = all(t);
 %@eof:2
diff --git a/src/utilities/convert/string2date.m b/src/utilities/convert/string2date.m
index 1a5d3c65779d57c0cb1f4cd8ec1aba4d00c5587e..eaafad3d530273f042a4d4ac6f5f65fe5006c97d 100644
--- a/src/utilities/convert/string2date.m
+++ b/src/utilities/convert/string2date.m
@@ -1,6 +1,6 @@
 function date = string2date(a) % --*-- Unitary tests --*--
 
-% Copyright (C) 2013-2020 Dynare Team
+% Copyright © 2013-2020 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -51,19 +51,9 @@ if ismonthly(a)
     return
 end
 
-if isweekly(a)
-    year = 1:(regexp(a,'[Ww]')-1);
-    date.freq = 52;
-    date.time = write_time_field(a, year);
-    return
-end
-
 if isdaily(a)
-    year = 1:(regexp(a,'[-]')-1);
-    month = 6:7;
-    day = 9:10;
     date.freq = 365;
-    date.time = write_time_field_d(a, year, month, day);
+    date.time(1) = datenum(a);
     return
 end
 
@@ -75,72 +65,63 @@ function b = write_time_field_y(c, d)
 b(1) = str2double(c(d));
 b(2) = 1;
 
-function b = write_time_field_d(c, y, m, d)
-b(1) = str2double(c(y));
-b(2) = str2double(c(m));
-b(3) = str2double(c(d));
+return
 
 %@test:1
-%$
-%$ % Define some dates
-%$ date_1 = '1950Q2';
-%$ date_2 = '1950m10';
-%$ date_3 = '1950w50';
-%$ date_4 = '1950a';
-%$ date_5 = '1967y';
-%$ date_6 = '2009A';
-%$ date_7 = '2009H1';
-%$ date_8 = '2009h2';
-%$ date_9 = '2009-01-01';
-%$
-%$ % Define expected results.
-%$ e_date_1 = [1950 2];
-%$ e_freq_1 = 4;
-%$ e_date_2 = [1950 10];
-%$ e_freq_2 = 12;
-%$ e_date_3 = [1950 50];
-%$ e_freq_3 = 52;
-%$ e_date_4 = [1950 1];
-%$ e_freq_4 = 1;
-%$ e_date_5 = [1967 1];
-%$ e_freq_5 = 1;
-%$ e_date_6 = [2009 1];
-%$ e_freq_6 = 1;
-%$ e_date_7 = [2009 1];
-%$ e_freq_7 = 2;
-%$ e_date_8 = [2009 2];
-%$ e_freq_8 = 2;
-%$ e_date_9 = [2009 365];
-%$ e_freq_9 = 365;
-%$
-%$ % Call the tested routine.
-%$ d1 = string2date(date_1);
-%$ d2 = string2date(date_2);
-%$ d3 = string2date(date_3);
-%$ d4 = string2date(date_4);
-%$ d5 = string2date(date_5);
-%$ d6 = string2date(date_6);
-%$ d7 = string2date(date_7);
-%$ d8 = string2date(date_8);
-%$ d9 = string2date(date_9);
-%$
-%$ % Check the results.
-%$ t(1) = dassert(d1.time,e_date_1);
-%$ t(2) = dassert(d2.time,e_date_2);
-%$ t(3) = dassert(d3.time,e_date_3);
-%$ t(4) = dassert(d4.time,e_date_4);
-%$ t(5) = dassert(d5.time,e_date_5);
-%$ t(6) = dassert(d6.time,e_date_6);
-%$ t(7) = dassert(d7.time,e_date_7);
-%$ t(8) = dassert(d8.time,e_date_8);
-%$ t(9) = dassert(d1.freq,e_freq_1);
-%$ t(10) = dassert(d2.freq,e_freq_2);
-%$ t(11) = dassert(d3.freq,e_freq_3);
-%$ t(12) = dassert(d4.freq,e_freq_4);
-%$ t(13)= dassert(d5.freq,e_freq_5);
-%$ t(14)= dassert(d6.freq,e_freq_6);
-%$ t(15)= dassert(d7.freq,e_freq_7);
-%$ t(16)= dassert(d8.freq,e_freq_8);
-%$ t(17)= dassert(d9.freq,e_freq_9);
-%$ T = all(t);
+% Define some dates
+date_1 = '1950Q2';
+date_2 = '1950m10';
+date_4 = '1950a';
+date_5 = '1967y';
+date_6 = '2009A';
+date_7 = '2009H1';
+date_8 = '2009h2';
+date_9 = '2009-01-01';
+
+% Define expected results.
+e_date_1 = [1950 2];
+e_freq_1 = 4;
+e_date_2 = [1950 10];
+e_freq_2 = 12;
+e_date_4 = [1950 1];
+e_freq_4 = 1;
+e_date_5 = [1967 1];
+e_freq_5 = 1;
+e_date_6 = [2009 1];
+e_freq_6 = 1;
+e_date_7 = [2009 1];
+e_freq_7 = 2;
+e_date_8 = [2009 2];
+e_freq_8 = 2;
+e_date_9 = [733774 NaN];
+e_freq_9 = 365;
+
+% Call the tested routine.
+d1 = string2date(date_1);
+d2 = string2date(date_2);
+d4 = string2date(date_4);
+d5 = string2date(date_5);
+d6 = string2date(date_6);
+d7 = string2date(date_7);
+d8 = string2date(date_8);
+d9 = string2date(date_9);
+
+% Check the results.
+t(1) = isequal(d1.time,e_date_1);
+t(2) = isequal(d2.time,e_date_2);
+t(3) = isequal(d4.time,e_date_4);
+t(4) = isequal(d5.time,e_date_5);
+t(5) = isequal(d6.time,e_date_6);
+t(6) = isequal(d7.time,e_date_7);
+t(7) = isequal(d8.time,e_date_8);
+t(8) = isequal(d1.freq,e_freq_1);
+t(9) = isequal(d2.freq,e_freq_2);
+t(10) = isequal(d4.freq,e_freq_4);
+t(11)= isequal(d5.freq,e_freq_5);
+t(12)= isequal(d6.freq,e_freq_6);
+t(13)= isequal(d7.freq,e_freq_7);
+t(14)= isequal(d8.freq,e_freq_8);
+t(15)= isequal(d9.freq,e_freq_9);
+t(16)= isequal(d9.time(1),e_date_9(1)) && isnan(d9.time(2));
+T = all(t);
 %@eof:1
\ No newline at end of file
diff --git a/src/utilities/convert/string2freq.m b/src/utilities/convert/string2freq.m
index ca5894ad800d544e4a79a62df6d0d1da21a9f08c..6f01cf95746cee89fa137171752473083c352434 100644
--- a/src/utilities/convert/string2freq.m
+++ b/src/utilities/convert/string2freq.m
@@ -1,12 +1,12 @@
 function freq = string2freq(s) % --*-- Unitary tests --*--
 
 % INPUTS
-%  o s        character, equal to Y, H, Q, M, W or D (resp. annual, bi-annual, quaterly, monthly, weekly or daily)
+% - s        [char]     scalar equal to Y, H, Q, M, or D (resp. annual, bi-annual, quaterly, monthly, or daily)
 %
 % OUTPUTS
-%  o freq     scalar integer,  equal to 1, 2, 4, 12, 52 or 365 (resp. annual, bi-annual, quaterly, monthly, weekly or daily)
+% - freq     [integer]  scalar equal to 1, 2, 4, 12, or 365 (resp. annual, bi-annual, quaterly, monthly, or daily)
 
-% Copyright (C) 2013-2020 Dynare Team
+% Copyright © 2013-2020 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -32,46 +32,44 @@ switch upper(s)
     freq = 4;
   case 'M'
     freq = 12;
-  case 'W'
-    freq = 52;
   case 'D'
     freq = 365;
   otherwise
     error('dates::freq2string: Unknown frequency!')
 end
 
+return
+
 %@test:1
-%$ try
-%$     nY = string2freq('Y');
-%$     nH = string2freq('H');
-%$     nQ = string2freq('Q');
-%$     nM = string2freq('M');
-%$     nW = string2freq('W');
-%$     nD = string2freq('D');
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ if t(1)
-%$     t(2) = dassert(nY, 1);
-%$     t(3) = dassert(nH, 2);
-%$     t(4) = dassert(nQ, 4);
-%$     t(5) = dassert(nM, 12);
-%$     t(6) = dassert(nW, 52);
-%$     t(7) = dassert(nD, 365);
-%$ end
-%$
-%$ T = all(t);
+try
+    nY = string2freq('Y');
+    nH = string2freq('H');
+    nQ = string2freq('Q');
+    nM = string2freq('M');
+    nD = string2freq('D');
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    t(2) = isequal(nY, 1);
+    t(3) = isequal(nH, 2);
+    t(4) = isequal(nQ, 4);
+    t(5) = isequal(nM, 12);
+    t(6) = isequal(nD, 365);
+end
+
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ try
-%$     n = string2freq('Z');
-%$     t(1) = false;
-%$ catch
-%$     t(1) = true;
-%$ end
-%$
-%$ T = all(t);
+try
+    n = string2freq('Z');
+    t(1) = false;
+catch
+    t(1) = true;
+end
+
+T = all(t);
 %@eof:2
diff --git a/src/utilities/from/from.m b/src/utilities/from/from.m
index 944b2b56920410c219dde3de3109e26a625298c3..4e8d3e0e914e870c08d8b2b3defe3163ec29bfb3 100644
--- a/src/utilities/from/from.m
+++ b/src/utilities/from/from.m
@@ -424,6 +424,7 @@ end
 i = 0;
 
 return
+
 %@test:1
 try
     y = dseries(zeros(400,1),dates('1950Q1')) ;
@@ -492,4 +493,18 @@ catch
 end
 
 T = all(t);
-%@eof:5
\ No newline at end of file
+%@eof:5
+
+%@test:6
+try
+    y = dseries(zeros(2*365+1,1),dates('2000-01-01')) ;
+    v = dseries(randn(2*365+1,1),dates('2000-01-01')) ;
+    u = dseries(randn(2*365+1,1),dates('2000-01-01')) ;
+    from 2000-01-02 to 2001-12-31 do y(t) = (1+.01*u(t))*y(t-1) + v(t)
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+T = all(t);
+%@eof:6
diff --git a/src/utilities/is/isdaily.m b/src/utilities/is/isdaily.m
index 9f5b85216f85577517d33da3879c8289a6c54bd8..7a1c1aeaf421c383e6ac4fc234c44b1bc8650c83 100644
--- a/src/utilities/is/isdaily.m
+++ b/src/utilities/is/isdaily.m
@@ -1,58 +1,59 @@
-function b = isdaily(str)  % --*-- Unitary tests --*--
-
-% Tests if the input can be interpreted as a daily date.
-%
-% INPUTS
-%  o str     string.
-%
-% OUTPUTS
-%  o b       integer scalar, equal to 1 if str can be interpreted as a daily date or 0 otherwise.
-
-% Copyright (C) 2020 Dynare Team
-%
-% This file is part of Dynare.
-%
-% Dynare is free software: you can redistribute it and/or modify
-% it under the terms of the GNU General Public License as published by
-% the Free Software Foundation, either version 3 of the License, or
-% (at your option) any later version.
-%
-% Dynare is distributed in the hope that it will be useful,
-% but WITHOUT ANY WARRANTY; without even the implied warranty of
-% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-% GNU General Public License for more details.
-%
-% You should have received a copy of the GNU General Public License
-% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
-
-if ischar(str)
-    if isempty(regexp(str,'^-?[0-9]+[-](0[1-9]|1[0-2])+[-]([0-2][0-9]|3[0-1])$','once'))
-        b = false;
-    else
-        b = true;
-    end
-else
-    b = false;
-end
-
-%@test:1
-%$
-%$ date_1 = '1950-03-29';
-%$ date_2 = '1950-12-31';
-%$ date_3 = '-1950-11-28';
-%$ date_4 = '1976-01-19';
-%$ date_5 = '1950 azd ';
-%$ date_6 = '1950Y';
-%$ date_7 = '1950Q3';
-%$ date_8 = '1950-13-39';
-%$
-%$ t(1) = dassert(isdaily(date_1),true);
-%$ t(2) = dassert(isdaily(date_2),true);
-%$ t(3) = dassert(isdaily(date_3),true);
-%$ t(4) = dassert(isdaily(date_4),true);
-%$ t(5) = dassert(isdaily(date_5),false);
-%$ t(6) = dassert(isdaily(date_6),false);
-%$ t(7) = dassert(isdaily(date_7),false);
-%$ t(8) = dassert(isdaily(date_8),false);
-%$ T = all(t);
+function b = isdaily(str)  % --*-- Unitary tests --*--
+
+% Tests if the input can be interpreted as a daily date.
+%
+% INPUTS
+% - str     [char]     1×n array, string to be tested.
+%
+% OUTPUTS
+% - b       [logical]  scalar, equal to true iff str can be interpreted as a daily date.
+
+% Copyright © 2020 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% Dynare is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
+
+if ischar(str)
+    if isempty(regexp(str,'^-?[0-9]+[-](0[1-9]|1[0-2])+[-](0[1-9]|[1-2][0-9]|3[0-1])$','once'))
+        b = false;
+    else
+        Thisday = strsplit(str, '-');
+        thisday = str2double(Thisday(end-2:end));
+        if length(Thisday)>3
+            % It is the case if we have an extra minus symbol because the year is before anno Domini.
+            thisday(1) = -thisday(1);
+        end
+        b = isvalidday(thisday);
+    end
+else
+    b = false;
+end
+
+return
+
+%@test:1
+t(1) = isdaily('1950-03-29');
+t(2) = isdaily('1950-12-31');
+t(3) = isdaily('-1950-11-28');
+t(4) = isdaily('1976-01-19');
+t(5) = ~isdaily('1950 azd');
+t(6) = ~isdaily('1950Y');
+t(7) = ~isdaily('1950Q3');
+t(8) = ~isdaily('1950-13-39');
+t(9) = ~isdaily('2000-12-00');
+t(10) = ~isdaily('1999-02-29');
+t(11) = isdaily('2000-02-29');
+T = all(t);
 %@eof:1
\ No newline at end of file
diff --git a/src/utilities/is/isdate.m b/src/utilities/is/isdate.m
index 78ef73ccacc91ec30abc1b1317cb6339b37db38c..d9f805988ef8c23d8a140ea1dc6d5bd240f86af2 100644
--- a/src/utilities/is/isdate.m
+++ b/src/utilities/is/isdate.m
@@ -3,12 +3,12 @@ function b = isdate(str)  % --*-- Unitary tests --*--
 % Tests if the input string can be interpreted as a date.
 %
 % INPUTS
-%  o str     string.
+% - str     [char]      1×m array, date (potentially)
 %
 % OUTPUTS
-%  o b       integer scalar, equal to 1 if str can be interpreted as a date or 0 otherwise.
+% - b       [logical]   scalar equal to true iff str can be interpreted as a date.
 
-% Copyright (C) 2013-2017 Dynare Team
+% Copyright © 2013-2020 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -32,24 +32,29 @@ end
 
 b = isstringdate(str);
 
+return
+
 %@test:1
-%$
-%$ date_1 = 1950;
-%$ date_2 = '1950m2';
-%$ date_3 = '-1950m2';
-%$ date_4 = '1950m52';
-%$ date_5 = ' 1950';
-%$ date_6 = '1950Y';
-%$ date_7 = '-1950a';
-%$ date_8 = '1950m ';
-%$
-%$ t(1) = dassert(isdate(date_1),true);
-%$ t(2) = dassert(isdate(date_2),true);
-%$ t(3) = dassert(isdate(date_3),true);
-%$ t(4) = dassert(isdate(date_4),false);
-%$ t(5) = dassert(isdate(date_5),false);
-%$ t(6) = dassert(isdate(date_6),true);
-%$ t(7) = dassert(isdate(date_7),true);
-%$ t(8) = dassert(isdate(date_8),false);
-%$ T = all(t);
+date_1 = 1950;
+date_2 = '1950m2';
+date_3 = '-1950m2';
+date_4 = '1950m52';
+date_5 = ' 1950';
+date_6 = '1950Y';
+date_7 = '-1950a';
+date_8 = '1950m ';
+date_9 = '2000-01-01';
+date_10 = '2000-02-30';
+
+t(1) = isequal(isdate(date_1), true);
+t(2) = isequal(isdate(date_2), true);
+t(3) = isequal(isdate(date_3), true);
+t(4) = isequal(isdate(date_4), false);
+t(5) = isequal(isdate(date_5), false);
+t(6) = isequal(isdate(date_6), true);
+t(7) = isequal(isdate(date_7), true);
+t(8) = isequal(isdate(date_8), false);
+t(9) = isequal(isdate(date_9), true);
+t(10) = isequal(isdate(date_10), false);
+T = all(t);
 %@eof:1
\ No newline at end of file
diff --git a/src/utilities/is/isdseries.m b/src/utilities/is/isdseries.m
index 3c9e71f90cd1556c378127e19fe091e195a80d93..2fe1aef20924b14092426a52dc0110c35c818f98 100644
--- a/src/utilities/is/isdseries.m
+++ b/src/utilities/is/isdseries.m
@@ -17,4 +17,35 @@ function B = isdseries(A)
 % You should have received a copy of the GNU General Public License
 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
 
-B = isa(A,'dseries');
\ No newline at end of file
+if ischar(A)
+    if exist(A, 'file')
+        [filepath, filename, ext] = fileparts(A);
+        switch ext
+          case '.mat'
+            listofexpectedobjects = {'INIT__', 'FREQ__', 'NAMES__', 'TEX__', 'OPS__', 'TAGS__', 'DATA__'};
+            fileContent = load(A);
+            listofobjects = fieldnames(fileContent);
+            if isempty(setdiff(listofexpectedobjects, listofobjects)) && isempty(setdiff(listofobjects, listofexpectedobjects))
+                B = true;
+            else
+                B = false;
+            end
+          case '.m'
+            listofexpectedobjects = {'INIT__', 'FREQ__', 'NAMES__', 'TEX__', 'OPS__'};
+            listofobjects = getlistofvariablesinscript(A);
+            listofobjects
+            if isempty(setdiff(listofexpectedobjects, listofobjects))
+                B = true;
+            else
+                B = false;
+            end
+          otherwise
+            error('Cannot test %s files.', ext)
+        end
+    else
+        % Input is not a char array referring to a file name.
+        B = false;
+    end
+else
+    B = isa(A,'dseries');
+end
\ No newline at end of file
diff --git a/src/utilities/is/isfreq.m b/src/utilities/is/isfreq.m
index 3bef38a862443c4d29f3480c9bf837a25ef4e8bb..2bb33117bc7c4885d090e3c898f2a23743789f74 100644
--- a/src/utilities/is/isfreq.m
+++ b/src/utilities/is/isfreq.m
@@ -3,12 +3,12 @@ function B = isfreq(A) % --*-- Unitary tests --*--
 % Tests if A can be interpreted as a frequency.
 %
 % INPUTS
-%  o A     scalar integer or character.
+% - A     [integer, char]  scalar, frequency code.
 %
 % OUTPUTS
-%  o B     scalar integer equal to one if A can be interpreted as a frequency, zero otherwise.
+% - B     [logical]        scalar equal to true iff A can be interpreted as a frequency.
 
-% Copyright (C) 2013-2020 Dynare Team
+% Copyright © 2013-2020 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -28,7 +28,7 @@ function B = isfreq(A) % --*-- Unitary tests --*--
 B = false;
 
 if ischar(A)
-    if isequal(length(A),1) && ismember(upper(A),{'Y','A', 'H', 'Q', 'M', 'W', 'D'})
+    if isequal(length(A),1) && ismember(upper(A),{'Y','A', 'H', 'Q', 'M', 'D'})
         B = true;
         return
     end
@@ -38,108 +38,79 @@ if isnumeric(A) && isequal(length(A),1) && ismember(A,[1 2 4 12 52 365])
     B = true;
 end
 
+return
+
 %@test:1
-%$ try
-%$     boolean = isfreq('w');
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ if t(1)
-%$     t(2) = dassert(boolean, true);
-%$ end
-%$
-%$ T = all(t);
+try
+    b = isfreq('M') && isfreq(12);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    t(2) = b;
+end
+
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ try
-%$     boolean = isfreq('W');
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ if t(1)
-%$     t(2) = dassert(boolean, true);
-%$ end
-%$
-%$ T = all(t);
+try
+    b = isfreq('Q') && isfreq(4);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    t(2) = b;
+end
+
+T = all(t);
 %@eof:2
 
 %@test:3
-%$ try
-%$     boolean = isfreq('M');
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ if t(1)
-%$     t(2) = dassert(boolean, true);
-%$ end
-%$
-%$ T = all(t);
+try
+    b = isfreq('Y') && isfreq(1);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    t(2) = b;
+end
+
+T = all(t);
 %@eof:3
 
 %@test:4
-%$ try
-%$     boolean = isfreq('Q');
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ if t(1)
-%$     t(2) = dassert(boolean, true);
-%$ end
-%$
-%$ T = all(t);
+try
+    b = isfreq('H') && isfreq(2);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    t(2) = b;
+end
+
+T = all(t);
 %@eof:4
 
 %@test:5
-%$ try
-%$     boolean = isfreq('Y');
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ if t(1)
-%$     t(2) = dassert(boolean, true);
-%$ end
-%$
-%$ T = all(t);
-%@eof:5
-
-%@test:6
-%$ try
-%$     boolean = isfreq('H');
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ if t(1)
-%$     t(2) = dassert(boolean, true);
-%$ end
-%$
-%$ T = all(t);
-%@eof:6
-
-%@test:7
-%$ try
-%$     boolean = isfreq('D');
-%$     t(1) = true;
-%$ catch
-%$     t(1) = false;
-%$ end
-%$
-%$ if t(1)
-%$     t(2) = dassert(boolean, true);
-%$ end
-%$
-%$ T = all(t);
-%@eof:7
+try
+    b = isfreq('D') && isfreq(365);
+    t(1) = true;
+catch
+    t(1) = false;
+end
+
+if t(1)
+    t(2) = b;
+end
 
+T = all(t);
+%@eof:5
\ No newline at end of file
diff --git a/src/utilities/is/isleapyear.m b/src/utilities/is/isleapyear.m
new file mode 100644
index 0000000000000000000000000000000000000000..365b721863af626bceafa4d2b1527dd023d48ccb
--- /dev/null
+++ b/src/utilities/is/isleapyear.m
@@ -0,0 +1,33 @@
+function b = isleapyear(y)
+
+% Returns true iff y is a leap year.
+%
+% INPUTS
+% - y     [integer]     scalar, year.
+%
+% OUTPUTS
+% - b     [logical]     scalar, equal to true iff y is a leap year.
+
+
+% Copyright © 2015-2020 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% Dynare is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
+
+if isnumeric(y) && isscalar(y) && isint(y)
+    b = isequal(mod(y,4), 0) && ( ~isequal(mod(y, 100), 0) || isequal(mod(y, 400), 0) );
+else
+    error('Input must be an integer scalar.')
+end
\ No newline at end of file
diff --git a/src/utilities/is/isstringdate.m b/src/utilities/is/isstringdate.m
index f199b7ea662b91135273febf984e3ac6c2755db1..516ec1ac8dad39c4937105f97b559796f1c8a7a7 100644
--- a/src/utilities/is/isstringdate.m
+++ b/src/utilities/is/isstringdate.m
@@ -26,52 +26,53 @@ function b = isstringdate(str)  % --*-- Unitary tests --*--
 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
 
 if ischar(str)
-    b = isquarterly(str) || isyearly(str) || isbiannual(str) || ismonthly(str) || isweekly(str) || isdaily(str);
+    b = isquarterly(str) || isyearly(str) || isbiannual(str) || ismonthly(str) || isdaily(str);
 else
     b = false;
 end
 
+return
+
 %@test:1
-%$
-%$ date_1 = '1950M2';
-%$ date_2 = '1950m2';
-%$ date_3 = '-1950m2';
-%$ date_4 = '1950m52';
-%$ date_5 = ' 1950';
-%$ date_6 = '1950Y';
-%$ date_7 = '-1950a';
-%$ date_8 = '1950m ';
-%$ date_9 = 'A';
-%$ date_10 = '1938Q';
-%$ date_11 = 'Q4';
-%$ date_12 = '1938M';
-%$ date_13 = 'M11';
-%$ date_14 = '1W';
-%$ date_15 = 'W1';
-%$ date_16 = '1948H1';
-%$ date_17 = 'h2';
-%$ date_18 = '1948-02-12';
-%$ date_19 = '12-30';
-%$
-%$ t(1) = dassert(isstringdate(date_1),true);
-%$ t(2) = dassert(isstringdate(date_2),true);
-%$ t(3) = dassert(isstringdate(date_3),true);
-%$ t(4) = dassert(isstringdate(date_4),false);
-%$ t(5) = dassert(isstringdate(date_5),false);
-%$ t(6) = dassert(isstringdate(date_6),true);
-%$ t(7) = dassert(isstringdate(date_7),true);
-%$ t(8) = dassert(isstringdate(date_8),false);
-%$ t(9) = dassert(isstringdate(date_9),false);
-%$ t(10) = dassert(isstringdate(date_10),false);
-%$ t(11) = dassert(isstringdate(date_11),false);
-%$ t(12) = dassert(isstringdate(date_12),false);
-%$ t(13) = dassert(isstringdate(date_13),false);
-%$ t(14) = dassert(isstringdate(date_14),false);
-%$ t(15) = dassert(isstringdate(date_15),false);
-%$ t(16) = dassert(isstringdate(date_16),true);
-%$ t(17) = dassert(isstringdate(date_17),false);
-%$ t(16) = dassert(isstringdate(date_18),true);
-%$ t(17) = dassert(isstringdate(date_19),false);
-%$
-%$ T = all(t);
+date_1 = '1950M2';
+date_2 = '1950m2';
+date_3 = '-1950m2';
+date_4 = '1950m52';
+date_5 = ' 1950';
+date_6 = '1950Y';
+date_7 = '-1950a';
+date_8 = '1950m ';
+date_9 = 'A';
+date_10 = '1938Q';
+date_11 = 'Q4';
+date_12 = '1938M';
+date_13 = 'M11';
+date_14 = '1W';
+date_15 = 'X1';
+date_16 = '1948H1';
+date_17 = 'h2';
+date_18 = '1948-02-12';
+date_19 = '12-30';
+
+t(1) = isstringdate(date_1);
+t(2) = isstringdate(date_2);
+t(3) = isstringdate(date_3);
+t(4) = ~isstringdate(date_4);
+t(5) = ~isstringdate(date_5);
+t(6) = isstringdate(date_6);
+t(7) = isstringdate(date_7);
+t(8) = ~isstringdate(date_8);
+t(9) = ~isstringdate(date_9);
+t(10) = ~isstringdate(date_10);
+t(11) = ~isstringdate(date_11);
+t(12) = ~isstringdate(date_12);
+t(13) = ~isstringdate(date_13);
+t(14) = ~isstringdate(date_14);
+t(15) = ~isstringdate(date_15);
+t(16) = isstringdate(date_16);
+t(17) = ~isstringdate(date_17);
+t(16) = isstringdate(date_18);
+t(17) = ~isstringdate(date_19);
+
+T = all(t);
 %@eof:1
\ No newline at end of file
diff --git a/src/utilities/is/isvalidday.m b/src/utilities/is/isvalidday.m
new file mode 100644
index 0000000000000000000000000000000000000000..45ebdd3769e9b20f3ce1f4e3be33d9dfc964ce53
--- /dev/null
+++ b/src/utilities/is/isvalidday.m
@@ -0,0 +1,84 @@
+function b = isvalidday(day)  % --*-- Unitary tests --*--
+
+% Tests if the input can be interpreted as a daily date.
+%
+% INPUTS
+% - day     [integer]     1×3 array, [year month day].
+%
+% OUTPUTS
+% - b       [logical]  scalar, equal to true iff day can be interpreted as a daily date.
+
+% Copyright © 2020 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% Dynare is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
+
+if isnumeric(day) && isrow(day) && length(day)==3
+    if day(2)>12 || day(2)<1
+        b = false;
+        return
+    end
+    if day(3)<1
+        b = false;
+        return
+    end
+    if ismember(day(2), [1 3 5 7 8 10 12]) && day(3)>31
+        b = false;
+        return
+    end
+    if ismember(day(2), [4 6 9 11]) && day(3)>30
+        b = false;
+        return
+    end
+    if day(2)==2
+        if isleapyear(day(1))
+            if day(3)>29
+                b = false;
+                return
+            end
+        else
+            if day(3)>28
+                b = false;
+                return
+            end
+        end
+    end
+else
+    error('Input must be a row vector of integers with 3 elements.')
+end
+
+b = true;
+
+return
+
+%@test:1
+t(1) = isvalidday([2000,1,1]) && isvalidday([2000,1,31]) && ~isvalidday([2000, 1, 32]);
+t(2) = isvalidday([2000,2,1]) && isvalidday([2000,2,29]) && ~isvalidday([2000, 2, 30]);
+t(3) = isvalidday([2000,3,1]) && isvalidday([2000,3,31]) && ~isvalidday([2000, 3, 32]);
+t(4) = isvalidday([2000,4,1]) && isvalidday([2000,4,30]) && ~isvalidday([2000, 4, 31]);
+t(5) = isvalidday([2000,5,1]) && isvalidday([2000,5,31]) && ~isvalidday([2000, 5, 32]);
+t(6) = isvalidday([2000,6,1]) && isvalidday([2000,6,30]) && ~isvalidday([2000, 6, 31]);
+t(7) = isvalidday([2000,7,1]) && isvalidday([2000,7,31]) && ~isvalidday([2000, 6, 32]);
+t(8) = isvalidday([2000,8,1]) && isvalidday([2000,8,31]) && ~isvalidday([2000, 8, 32]);
+t(9) = isvalidday([2000,9,1]) && isvalidday([2000,9,30]) && ~isvalidday([2000, 9, 31]);
+t(10) = isvalidday([2000,10,1]) && isvalidday([2000,10,31]) && ~isvalidday([2000, 10, 32]);
+t(11) = isvalidday([2000,11,1]) && isvalidday([2000,11,30]) && ~isvalidday([2000, 11, 31]);
+t(12) = isvalidday([2000,11,1]) && isvalidday([2000,11,30]) && ~isvalidday([2000, 11, 31]);
+t(13) = isvalidday([2001,2,1]) && isvalidday([2001,2,28]) && ~isvalidday([2001, 2, 29]);
+t(14) = ~isvalidday([2000, 1, 0]);
+t(15) = ~isvalidday([2000, 0, 1]);
+t(16) = isvalidday([0, 1, 1]);
+T = all(t);
+%@eof:1
\ No newline at end of file
diff --git a/src/utilities/is/isweekly.m b/src/utilities/is/isweekly.m
deleted file mode 100644
index a8fdc02934f8c62a86e0d7cafe8e4b274b894528..0000000000000000000000000000000000000000
--- a/src/utilities/is/isweekly.m
+++ /dev/null
@@ -1,58 +0,0 @@
-function b = isweekly(str)  % --*-- Unitary tests --*--
-
-% Tests if the input can be interpreted as a weekly date.
-%
-% INPUTS
-%  o str     string.
-%
-% OUTPUTS
-%  o b       integer scalar, equal to 1 if str can be interpreted as a weekly date or 0 otherwise.
-
-% Copyright (C) 2012-2017 Dynare Team
-%
-% This file is part of Dynare.
-%
-% Dynare is free software: you can redistribute it and/or modify
-% it under the terms of the GNU General Public License as published by
-% the Free Software Foundation, either version 3 of the License, or
-% (at your option) any later version.
-%
-% Dynare is distributed in the hope that it will be useful,
-% but WITHOUT ANY WARRANTY; without even the implied warranty of
-% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-% GNU General Public License for more details.
-%
-% You should have received a copy of the GNU General Public License
-% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
-
-if ischar(str)
-    if isempty(regexp(str,'^-?[0-9]+[Ww]([1-9]|[1-4][0-9]|5[0-2])$','once'))
-        b = false;
-    else
-        b = true;
-    end
-else
-    b = false;
-end
-
-%@test:1
-%$
-%$ date_1 = '1950W2';
-%$ date_2 = '1950w2';
-%$ date_3 = '-1950w2';
-%$ date_4 = '1950w22';
-%$ date_5 = '1950 azd';
-%$ date_6 = '1950Y';
-%$ date_7 = '1950Q3';
-%$ date_8 = '1950m54';
-%$
-%$ t(1) = dassert(isweekly(date_1),true);
-%$ t(2) = dassert(isweekly(date_2),true);
-%$ t(3) = dassert(isweekly(date_3),true);
-%$ t(4) = dassert(isweekly(date_4),true);
-%$ t(5) = dassert(isweekly(date_5),false);
-%$ t(6) = dassert(isweekly(date_6),false);
-%$ t(7) = dassert(isweekly(date_7),false);
-%$ t(8) = dassert(isweekly(date_8),false);
-%$ T = all(t);
-%@eof:1
\ No newline at end of file
diff --git a/src/utilities/misc/getlistofvariablesinscript.m b/src/utilities/misc/getlistofvariablesinscript.m
new file mode 100644
index 0000000000000000000000000000000000000000..6a8ae57011c38938dacba5fc9e3a81784fdfac5f
--- /dev/null
+++ b/src/utilities/misc/getlistofvariablesinscript.m
@@ -0,0 +1,29 @@
+function list = getlistofvariablesinscript(mscript)
+
+% Returns the list of variables in a script.
+%
+% INPUTS
+% - mscript   [char]   1×n array, name of a matlab script.
+%
+% OUTPUTS
+% - list      [cell]   cell of row char arrays, list of variables defined in mscript.
+
+if ~ischar(mscript)
+    error('Input argument must be a row char array (name of a matlab script')
+end
+
+if ~exist(mscript, 'file')
+    error('Cannot find %s.', mscript)
+end
+
+[filepath, filename, ext] = fileparts(mscript);
+
+if ~isequal(ext, '.m')
+    error('Wrong extension')
+end
+
+run(mscript);
+
+list = whos;
+list = {list(:).name};
+list = setdiff(list, {'filepath', 'filename', 'ext', 'mscript'});
\ No newline at end of file
diff --git a/src/utilities/op/add_periods_to_array_of_dates.m b/src/utilities/op/add_periods_to_array_of_dates.m
index 6a2171a164b34c713e5c002a8e85d679bfb8b5e6..0d48b2038affd7479b69d00c6f57bbb46d4ef268 100644
--- a/src/utilities/op/add_periods_to_array_of_dates.m
+++ b/src/utilities/op/add_periods_to_array_of_dates.m
@@ -2,7 +2,7 @@ function time = add_periods_to_array_of_dates(time, freq, p)  % --*-- Unitary te
 
 % Adds a p periods (p can be negative) to a date (or a set of dates) characterized by array time and frequency freq.
 
-% Copyright (C) 2013-2017 Dynare Team
+% Copyright © 2013-2020 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -23,6 +23,11 @@ if isequal(rows(time),1) && length(p)>1
     time = repmat(time,length(p),1);
 end
 
+if freq==365
+    time(:,1) = time(:,1) + p;
+    return
+end
+
 time(:,1) = time(:,1) + fix(p/freq);
 time(:,2) = time(:,2) + rem(p,freq);
 
@@ -38,46 +43,48 @@ if ~isempty(id2)
     time(id2,2) = time(id2,2) + freq;
 end
 
+return
+
 %@test:1
-%$ t(1) = dassert(add_periods_to_array_of_dates([1950 1], 4, 1),[1950 2]);
-%$ t(2) = dassert(add_periods_to_array_of_dates([1950 1], 4, 2),[1950 3]);
-%$ t(3) = dassert(add_periods_to_array_of_dates([1950 1], 4, 3),[1950 4]);
-%$ t(4) = dassert(add_periods_to_array_of_dates([1950 1], 4, 4),[1951 1]);
-%$ t(5) = dassert(add_periods_to_array_of_dates([1950 1], 4, 5),[1951 2]);
-%$ t(6) = dassert(add_periods_to_array_of_dates([1950 1], 4, 6),[1951 3]);
-%$ t(7) = dassert(add_periods_to_array_of_dates([1950 1], 4, 7),[1951 4]);
-%$ t(8) = dassert(add_periods_to_array_of_dates([1950 1], 4, 8),[1952 1]);
-%$ T = all(t);
+t(1) = isequal(add_periods_to_array_of_dates([1950 1], 4, 1),[1950 2]);
+t(2) = isequal(add_periods_to_array_of_dates([1950 1], 4, 2),[1950 3]);
+t(3) = isequal(add_periods_to_array_of_dates([1950 1], 4, 3),[1950 4]);
+t(4) = isequal(add_periods_to_array_of_dates([1950 1], 4, 4),[1951 1]);
+t(5) = isequal(add_periods_to_array_of_dates([1950 1], 4, 5),[1951 2]);
+t(6) = isequal(add_periods_to_array_of_dates([1950 1], 4, 6),[1951 3]);
+t(7) = isequal(add_periods_to_array_of_dates([1950 1], 4, 7),[1951 4]);
+t(8) = isequal(add_periods_to_array_of_dates([1950 1], 4, 8),[1952 1]);
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ t(1) = dassert(add_periods_to_array_of_dates(repmat([1950 1],8,1), 4, transpose(1:8)),[1950 2; 1950 3; 1950 4; 1951 1; 1951 2; 1951 3; 1951 4; 1952 1]);
-%$ T = all(t);
+t(1) = isequal(add_periods_to_array_of_dates(repmat([1950 1],8,1), 4, transpose(1:8)),[1950 2; 1950 3; 1950 4; 1951 1; 1951 2; 1951 3; 1951 4; 1952 1]);
+T = all(t);
 %@eof:2
 
 %@test:3
-%$ t(1) = dassert(add_periods_to_array_of_dates([1950 1], 1, 1),[1951 1]);
-%$ T = all(t);
+t(1) = isequal(add_periods_to_array_of_dates([1950 1], 1, 1),[1951 1]);
+T = all(t);
 %@eof:3
 
 %@test:4
-%$ t(1) = dassert(add_periods_to_array_of_dates([1950 1; 1950 2; 1950 3; 1950 4], 4, 1),[1950 2; 1950 3; 1950 4; 1951 1]);
-%$ T = all(t);
+t(1) = isequal(add_periods_to_array_of_dates([1950 1; 1950 2; 1950 3; 1950 4], 4, 1),[1950 2; 1950 3; 1950 4; 1951 1]);
+T = all(t);
 %@eof:4
 
 %@test:5
-%$ t(1) = dassert(add_periods_to_array_of_dates([1950 1], 4, transpose(1:8)),[1950 2; 1950 3; 1950 4; 1951 1; 1951 2; 1951 3; 1951 4; 1952 1]);
-%$ T = all(t);
+t(1) = isequal(add_periods_to_array_of_dates([1950 1], 4, transpose(1:8)),[1950 2; 1950 3; 1950 4; 1951 1; 1951 2; 1951 3; 1951 4; 1952 1]);
+T = all(t);
 %@eof:5
 
 %@test:6
-%$ t(1) = dassert(add_periods_to_array_of_dates([1950 1], 4, -1),[1949 4]);
-%$ t(2) = dassert(add_periods_to_array_of_dates([1950 1], 4, -2),[1949 3]);
-%$ t(3) = dassert(add_periods_to_array_of_dates([1950 1], 4, -3),[1949 2]);
-%$ t(4) = dassert(add_periods_to_array_of_dates([1950 1], 4, -4),[1949 1]);
-%$ t(5) = dassert(add_periods_to_array_of_dates([1950 1], 4, -5),[1948 4]);
-%$ t(6) = dassert(add_periods_to_array_of_dates([1950 1], 4, -6),[1948 3]);
-%$ t(7) = dassert(add_periods_to_array_of_dates([1950 1], 4, -7),[1948 2]);
-%$ t(8) = dassert(add_periods_to_array_of_dates([1950 1], 4, -8),[1948 1]);
-%$ T = all(t);
+t(1) = isequal(add_periods_to_array_of_dates([1950 1], 4, -1),[1949 4]);
+t(2) = isequal(add_periods_to_array_of_dates([1950 1], 4, -2),[1949 3]);
+t(3) = isequal(add_periods_to_array_of_dates([1950 1], 4, -3),[1949 2]);
+t(4) = isequal(add_periods_to_array_of_dates([1950 1], 4, -4),[1949 1]);
+t(5) = isequal(add_periods_to_array_of_dates([1950 1], 4, -5),[1948 4]);
+t(6) = isequal(add_periods_to_array_of_dates([1950 1], 4, -6),[1948 3]);
+t(7) = isequal(add_periods_to_array_of_dates([1950 1], 4, -7),[1948 2]);
+t(8) = isequal(add_periods_to_array_of_dates([1950 1], 4, -8),[1948 1]);
+T = all(t);
 %@eof:6
\ No newline at end of file
diff --git a/src/utilities/op/add_periods_to_date.m b/src/utilities/op/add_periods_to_date.m
index 6cfee337d206b49f6fa23c325a433941b412b0eb..a64b8ebf381b1089db5edec12678822b7ee42f49 100644
--- a/src/utilities/op/add_periods_to_date.m
+++ b/src/utilities/op/add_periods_to_date.m
@@ -19,6 +19,10 @@ function time = add_periods_to_date(time, freq, p)  % --*-- Unitary tests --*--
 % You should have received a copy of the GNU General Public License
 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
 
+if freq==365
+    time(1) = time(1)+p;
+end
+
 time(1) = time(1) + fix(p/freq);
 time(2) = time(2) + rem(p,freq);
 
@@ -32,26 +36,28 @@ if time(2)<1
     time(2) = time(2) + freq;
 end
 
+return
+
 %@test:1
-%$ t(1) = dassert(add_periods_to_date([1950 1], 4, 1),[1950 2]);
-%$ t(2) = dassert(add_periods_to_date([1950 1], 4, 2),[1950 3]);
-%$ t(3) = dassert(add_periods_to_date([1950 1], 4, 3),[1950 4]);
-%$ t(4) = dassert(add_periods_to_date([1950 1], 4, 4),[1951 1]);
-%$ t(5) = dassert(add_periods_to_date([1950 1], 4, 5),[1951 2]);
-%$ t(6) = dassert(add_periods_to_date([1950 1], 4, 6),[1951 3]);
-%$ t(7) = dassert(add_periods_to_date([1950 1], 4, 7),[1951 4]);
-%$ t(8) = dassert(add_periods_to_date([1950 1], 4, 8),[1952 1]);
-%$ T = all(t);
+t(1) = dassert(add_periods_to_date([1950 1], 4, 1),[1950 2]);
+t(2) = dassert(add_periods_to_date([1950 1], 4, 2),[1950 3]);
+t(3) = dassert(add_periods_to_date([1950 1], 4, 3),[1950 4]);
+t(4) = dassert(add_periods_to_date([1950 1], 4, 4),[1951 1]);
+t(5) = dassert(add_periods_to_date([1950 1], 4, 5),[1951 2]);
+t(6) = dassert(add_periods_to_date([1950 1], 4, 6),[1951 3]);
+t(7) = dassert(add_periods_to_date([1950 1], 4, 7),[1951 4]);
+t(8) = dassert(add_periods_to_date([1950 1], 4, 8),[1952 1]);
+T = all(t);
 %@eof:1
 
 %@test:2
-%$ t(1) = dassert(add_periods_to_date([1950 1], 4, -1),[1949 4]);
-%$ t(2) = dassert(add_periods_to_date([1950 1], 4, -2),[1949 3]);
-%$ t(3) = dassert(add_periods_to_date([1950 1], 4, -3),[1949 2]);
-%$ t(4) = dassert(add_periods_to_date([1950 1], 4, -4),[1949 1]);
-%$ t(5) = dassert(add_periods_to_date([1950 1], 4, -5),[1948 4]);
-%$ t(6) = dassert(add_periods_to_date([1950 1], 4, -6),[1948 3]);
-%$ t(7) = dassert(add_periods_to_date([1950 1], 4, -7),[1948 2]);
-%$ t(8) = dassert(add_periods_to_date([1950 1], 4, -8),[1948 1]);
-%$ T = all(t);
+t(1) = dassert(add_periods_to_date([1950 1], 4, -1),[1949 4]);
+t(2) = dassert(add_periods_to_date([1950 1], 4, -2),[1949 3]);
+t(3) = dassert(add_periods_to_date([1950 1], 4, -3),[1949 2]);
+t(4) = dassert(add_periods_to_date([1950 1], 4, -4),[1949 1]);
+t(5) = dassert(add_periods_to_date([1950 1], 4, -5),[1948 4]);
+t(6) = dassert(add_periods_to_date([1950 1], 4, -6),[1948 3]);
+t(7) = dassert(add_periods_to_date([1950 1], 4, -7),[1948 2]);
+t(8) = dassert(add_periods_to_date([1950 1], 4, -8),[1948 1]);
+T = all(t);
 %@eof:2
\ No newline at end of file