Last active
June 2, 2017 17:06
-
-
Save ssouris/c708d57ce3589f2b9c5b72ae917f3d75 to your computer and use it in GitHub Desktop.
Revisions
-
ssouris revised this gist
Jun 2, 2017 . No changes.There are no files selected for viewing
-
ssouris revised this gist
Jun 2, 2017 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ fun LocalDate.toStr(format:String = "dd/MM/yyyy") = DateTimeFormatter.ofPattern(format).format(this) fun String.toDate(format:String = "dd/MM/yyyy") = LocalDate.parse(this, DateTimeFormatter.ofPattern(format)) @@ -10,4 +11,4 @@ fun `Test LocalDate#toStr extension method`() { @Test fun `Test String#toLocalDate extension method`() { Assert.assertEquals("01/01/1970".toLocalDate(), LocalDate.of(1970, 1, 1)) } -
ssouris revised this gist
Jun 2, 2017 . 1 changed file with 0 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,3 @@ fun LocalDate.toStr(format:String = "dd/MM/yyyy") = DateTimeFormatter.ofPattern(format).format(this) fun String.toDate(format:String = "dd/MM/yyyy") = LocalDate.parse(this, DateTimeFormatter.ofPattern(format)) -
ssouris renamed this gist
Jun 2, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
ssouris revised this gist
Jun 2, 2017 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,9 @@ fun ServerResponse.BodyBuilder.html() = contentType(TEXT_HTML) // example usage -> ok().html().render("pets/edit", it) // Date Extension methods fun LocalDate.toStr(format:String = "dd/MM/yyyy") = DateTimeFormatter.ofPattern(format).format(this) fun String.toDate(format:String = "dd/MM/yyyy") = LocalDate.parse(this, DateTimeFormatter.ofPattern(format)) -
ssouris created this gist
Jun 2, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ fun ServerResponse.BodyBuilder.html() = contentType(TEXT_HTML) // Date Extension methods fun LocalDate.toStr(format:String = "dd/MM/yyyy") = DateTimeFormatter.ofPattern(format).format(this) fun String.toDate(format:String = "dd/MM/yyyy") = LocalDate.parse(this, DateTimeFormatter.ofPattern(format)) @Test fun `Test LocalDate#toStr extension method`() { Assert.assertEquals(LocalDate.of(1970, 1, 1).toStr(), "01/01/1970") } @Test fun `Test String#toLocalDate extension method`() { Assert.assertEquals("01/01/1970".toLocalDate(), LocalDate.of(1970, 1, 1)) }