Skip to content

Commit

Permalink
Rename library from 'days' to 'date'
Browse files Browse the repository at this point in the history
This is not the final library name as it is too official to take but
I didn't like 'days' either.

Also clean up some compiler warnings about unused code and imports.
  • Loading branch information
michaeljones committed Jun 9, 2024
1 parent b1e5480 commit 32d2de5
Show file tree
Hide file tree
Showing 9 changed files with 416 additions and 448 deletions.
25 changes: 2 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,4 @@
# days
# date

[![Package Version](https://img.shields.io/hexpm/v/days)](https://hex.pm/packages/days)
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/days/)
Temporary name.

```sh
gleam add days
```
```gleam
import days
pub fn main() {
// TODO: An example of the project in use
}
```

Further documentation can be found at <https://hexdocs.pm/days>.

## Development

```sh
gleam run # Run the project
gleam test # Run the tests
gleam shell # Run an Erlang shell
```
3 changes: 2 additions & 1 deletion gleam.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name = "days"
name = "date"
version = "1.0.0"

# Fill out these fields if you intend to generate HTML documentation or publish
Expand All @@ -13,6 +13,7 @@ version = "1.0.0"
# https://gleam.run/writing-gleam/gleam-toml/.

internal_modules = [
"days/parse",
"days/pattern",
]

Expand Down
7 changes: 3 additions & 4 deletions src/days.gleam → src/date.gleam
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import gleam/bool
import gleam/float
import gleam/int
import gleam/io
import gleam/list
import gleam/option.{None, Some}
import gleam/option
import gleam/order.{type Order}
import gleam/result
import gleam/string
import nibble
import nibble/lexer as nibble_lexer

import days/parse.{Dash, Digit, TimeToken, WeekToken} as days_parse
import days/pattern.{type Token, Field, Literal}
import date/parse.{Dash, Digit, TimeToken, WeekToken} as days_parse
import date/pattern.{type Token, Field, Literal}

// module Date exposing

Expand Down
File renamed without changes.
8 changes: 0 additions & 8 deletions src/days/pattern.gleam → src/date/pattern.gleam
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import gleam/io
import gleam/list
import gleam/result
import gleam/set
Expand Down Expand Up @@ -68,13 +67,6 @@ fn is_quote(token: LexerToken) {
}
}

fn is_escaped_quote(token: LexerToken) {
case token {
EscapedQuote -> True
_ -> False
}
}

fn extract_content(tokens: List(LexerToken)) {
case tokens {
[] -> ""
Expand Down
12 changes: 6 additions & 6 deletions test/days_parse_test.gleam → test/date_parse_test.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import gleam/result
import gleeunit/should
import nibble/lexer as nl

import days
import days/parse as dp
import date
import date/parse as dp

pub fn lex_ordinal_date_test() {
nl.run("2019-269", dp.lexer())
Expand Down Expand Up @@ -71,11 +71,11 @@ pub fn lex_calendar_date_test() {
}

pub fn parse_calendar_date_test() {
days.from_iso_string("2018-09-26")
|> should.equal(Ok(days.from_calendar_date(2018, days.Sep, 26)))
date.from_iso_string("2018-09-26")
|> should.equal(Ok(date.from_calendar_date(2018, date.Sep, 26)))
}

pub fn parse_week_weekday_date_test() {
days.from_iso_string("2009-W01-4")
|> should.equal(Ok(days.from_calendar_date(2009, days.Jan, 1)))
date.from_iso_string("2009-W01-4")
|> should.equal(Ok(date.from_calendar_date(2009, date.Jan, 1)))
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import gleam/list
import gleeunit/should

import days/pattern.{Field, Literal}
import date/pattern.{Field, Literal}

// test_fromString : Test
// test_fromString =
Expand Down
Loading

0 comments on commit 32d2de5

Please sign in to comment.