Support date without time
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Start by reproducing the failure with the Todo.swift model and CreateTodo migration using a SQLite database and an ISO8601 date. Trace the SQLite date decoding path from the failing retrieval; done means fetching the todos succeeds and the Date field decodes without the reported error.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Vapor 4 cannot decode dates.
Steps to reproduce
-
Create an empty project using vapor-beta toolbox and using a SQLite database for testing purposes.
-
Open Todo.swift file and add a field to store a date
Todo model file looks:
import Fluent
import Vapor
final class Todo: Model, Content {
static let schema = "todos"
@ID(key: .id)
var id: UUID?
@Field(key: "title")
var title: String
@Field(key: "date")
var date: Date
init() { }
init(id: UUID? = nil, title: String, date: Date) {
self.id = id
self.title = title
self.date = date
}
}
- Configure the field on the migration file.
import Fluent
struct CreateTodo: Migration {
func prepare(on database: Database) -> EventLoopFuture<Void> {
return database.schema("todos")
.id()
.field("title", .string, .required)
.field("date", .date, .required)
.create()
}
func revert(on database: Database) -> EventLoopFuture<Void> {
return database.schema("todos").delete()
}
}
-
Run the migrations.
-
Create a new Todo with ISO8601 date.
-
Try to get the todos. It fails.
Expected behavior
The list of todos is returned.
Actual behavior
[ ERROR ] invalid field: date type: Date error: Decoding error: Value of type 'Date' required for key ''.
Environment
- Vapor Framework version: 4.0.0-rc.3.12
- Fluent Framework version: 4.0.0-rc.1
- Fluent-kit Framework version: 4.0.0-rc.1.16
- Fluent-sqlite-driver Framework version: 4.0.0-rc.1.1
- OS version: macOS 10.15.4
- Lingua principale
- Swift
- Stelle
- 72
- Fork
- 34
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
[BUG] File transcription skips audio chunks shorter than one secondForse già presa @sabbah13 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
altic-dev/FluidVoice#1161 ·
I maintainer di solito rispondono entro 1 giorno
-
swift.md: `Date(myString, strategy: .iso8601)` example omits `try` — the initializer is throwingAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
githubnext/desktop-tools#25 ·
I maintainer di solito rispondono entro 1 giorno
-
core: RAC_LLM_OPTIONS_DEFAULT.min_p disagrees with the IDL's annotated defaultForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertabug core p3
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
RunanywhereAI/runanywhere-sdks#1083 ·
I maintainer di solito rispondono entro 5 giorni