File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,9 +26,11 @@ var commonGrpc = require('@google-cloud/common-grpc');
2626var is = require ( 'is' ) ;
2727
2828function SpannerDate ( value ) {
29- if ( is . number ( value ) ) {
30- throw new TypeError ( 'The spanner.date function accepts a Date object, ' +
31- 'or a string parseable by Date\'s constructor.' ) ;
29+ if ( arguments . length > 1 ) {
30+ throw new TypeError (
31+ 'The spanner.date function accepts a Date object, ' +
32+ 'or a single argument parseable by Date\'s constructor.'
33+ ) ;
3234 }
3335 if ( is . undefined ( value ) ) {
3436 value = new Date ( ) ;
Original file line number Diff line number Diff line change @@ -54,9 +54,9 @@ describe('codec', function() {
5454 assert . strictEqual ( spannerDate . value , date . toJSON ( ) . replace ( / T .+ / , '' ) ) ;
5555 } ) ;
5656
57- it ( 'should choke on an integer ' , function ( ) {
57+ it ( 'should choke on multiple arguments ' , function ( ) {
5858 assert . throws ( function ( ) {
59- new codec . SpannerDate ( 2017 ) ;
59+ new codec . SpannerDate ( 2012 , 3 , 21 ) ;
6060 } , / T h e s p a n n e r \. d a t e f u n c t i o n a c c e p t s a D a t e o b j e c t , / ) ;
6161 } ) ;
6262 } ) ;
You can’t perform that action at this time.
0 commit comments