Skip to content

Commit

Permalink
Rename library to 'rada'
Browse files Browse the repository at this point in the history
But keep all the functionality in a module called 'date' so that you
import 'rada/date' and use 'date' everywhere.
  • Loading branch information
michaeljones committed Jun 27, 2024
1 parent 7360a43 commit 1354b10
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 18 deletions.
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
# date
# rada

Temporary name.
This package provides a simple `Date` type for working with dates without times or zones.

## Origins

This is a port of the [justinmimbs/date](https://package.elm-lang.org/packages/justinmimbs/date/latest) Elm library.
Done with the kind permission of the author. The API has been adjusted to match norms of the Gleam language in places.

Currently the `fromPosix` function have not yet been ported.
## Installation

```sh
gleam add rada
```

## Usage

Documentation can be found at <https://hexdocs.pm/rada>.

11 changes: 7 additions & 4 deletions gleam.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name = "date"
version = "1.0.0"
name = "rada"
version = "0.1.0"
description = "A library for dates with no times or time zones"
licences = ["BSD-3-Clause"]
repository = { type = "github", user = "michaeljones", repo = "rada" }

# Fill out these fields if you intend to generate HTML documentation or publish
# your project to the Hex package manager.
Expand All @@ -13,8 +16,8 @@ version = "1.0.0"
# https://gleam.run/writing-gleam/gleam-toml/.

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

[dependencies]
Expand Down
10 changes: 5 additions & 5 deletions src/date.gleam → src/rada/date.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import gleam/string
import nibble
import nibble/lexer as nibble_lexer

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

// module Date exposing

Expand Down Expand Up @@ -787,7 +787,7 @@ fn to_calendar_date_helper(
//
//
// {-| -}
// toWeekDate : Date -> { weekYear : Int, weekNumber : Int, weekday : Weekday }
// toWeekDate :dd Date -> { weekYear : Int, weekNumber : Int, weekday : Weekday }
// toWeekDate (RD rd) =
// let
// wdn =
Expand Down Expand Up @@ -2593,8 +2593,8 @@ pub fn today() -> Date {
from_calendar_date(year, number_to_month(month_number), day)
}

@external(erlang, "date_ffi", "get_year_month_day")
@external(javascript, "./date_ffi.mjs", "get_year_month_day")
@external(erlang, "rada_ffi", "get_year_month_day")
@external(javascript, "../rada_ffi.mjs", "get_year_month_day")
fn get_year_month_day() -> #(Int, Int, Int)

//
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/date_ffi.erl → src/rada_ffi.erl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

-module(date_ffi).
-module(rada_ffi).

-export([
get_year_month_day/0
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion test/french_language.gleam
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import gleam/int
import gleam/string

import date
import rada/date

// fr : Date.Language
// fr =
Expand Down
4 changes: 2 additions & 2 deletions test/date_parse_test.gleam → test/rada_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 date
import date/parse as dp
import rada/date
import rada/date/parse as dp

pub fn lex_ordinal_date_test() {
nl.run("2019-269", dp.lexer())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import gleam/list
import gleeunit/should

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

// test_fromString : Test
// test_fromString =
Expand Down
4 changes: 3 additions & 1 deletion test/date_test.gleam → test/rada_test.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import gleam/result
import gleeunit
import gleeunit/should

import date.{type CalendarDate, type Date, type WeekDate, CalendarDate, WeekDate}
import french_language.{language_fr}
import rada/date.{
type CalendarDate, type Date, type WeekDate, CalendarDate, WeekDate,
}

pub fn main() {
gleeunit.main()
Expand Down

0 comments on commit 1354b10

Please sign in to comment.