Skip to content

Commit

Permalink
Bumped v4.2.1
Browse files Browse the repository at this point in the history
Signed-off-by: Matteo Collina <hello@matteocollina.com>
  • Loading branch information
mcollina committed Jul 12, 2022
1 parent 07a5d9a commit d6e06c7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion fastify.js
@@ -1,6 +1,6 @@
'use strict'

const VERSION = '4.2.0'
const VERSION = '4.2.1'

const Avvio = require('avvio')
const http = require('http')
Expand Down
24 changes: 12 additions & 12 deletions lib/error-serializer.js
Expand Up @@ -74,36 +74,36 @@ class Serializer {
return bool === null ? 'null' : this.asBoolean(bool)
}

asDatetime (date) {
const quotes = '"'
asDateTime (date) {
if (date === null) return '""'
if (date instanceof Date) {
return quotes + date.toISOString() + quotes
return '"' + date.toISOString() + '"'
}
return this.asString(date)
throw new Error(`The value "${date}" cannot be converted to a date-time.`)
}

asDatetimeNullable (date) {
return date === null ? 'null' : this.asDatetime(date)
asDateTimeNullable (date) {
return date === null ? 'null' : this.asDateTime(date)
}

asDate (date) {
const quotes = '"'
if (date === null) return '""'
if (date instanceof Date) {
return quotes + new Date(date.getTime() - (date.getTimezoneOffset() * 60000)).toISOString().slice(0, 10) + quotes
return '"' + new Date(date.getTime() - (date.getTimezoneOffset() * 60000)).toISOString().slice(0, 10) + '"'
}
return this.asString(date)
throw new Error(`The value "${date}" cannot be converted to a date.`)
}

asDateNullable (date) {
return date === null ? 'null' : this.asDate(date)
}

asTime (date) {
const quotes = '"'
if (date === null) return '""'
if (date instanceof Date) {
return quotes + new Date(date.getTime() - (date.getTimezoneOffset() * 60000)).toISOString().slice(11, 19) + quotes
return '"' + new Date(date.getTime() - (date.getTimezoneOffset() * 60000)).toISOString().slice(11, 19) + '"'
}
return this.asString(date)
throw new Error(`The value "${date}" cannot be converted to a time.`)
}

asTimeNullable (date) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "fastify",
"version": "4.2.0",
"version": "4.2.1",
"description": "Fast and low overhead web framework, for Node.js",
"main": "fastify.js",
"type": "commonjs",
Expand Down

0 comments on commit d6e06c7

Please sign in to comment.