Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fixes #15

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Sources/Parsers/ES/ESWeekdayParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ private let PATTERN = "(\\W|^)" +
"(?:(este|pasado|pr[oó]ximo)\\s*)?" +
"(\(ES_WEEKDAY_OFFSET.keys.joined(separator: "|")))" +
"(?:\\s*(?:\\,|\\)|\\)))?" +
"(?:\\s*(este|pasado|pr[óo]ximo)\\s*week)?" +
"(?:\\s*(esta|pasada|pr[óo]xima)\\s*semana)?" +
"(?=\\W|$)"

private let prefixGroup = 2
Expand All @@ -39,13 +39,13 @@ public class ESWeekdayParser: Parser {
if prefix != nil || postfix != nil {
let norm = (prefix ?? postfix ?? "").lowercased()

if norm == "pasado" {
if norm == "pasado" || norm == "pasada" {
modifier = "last"
}
else if norm == "próximo" || norm == "proximo" {
else if norm == "próximo" || norm == "proximo" || norm == "próxima" || norm == "proxima" {
modifier = "next"
}
else if norm == "este" {
else if norm == "este" || norm == "esta" {
modifier = "this"
}
}
Expand Down
14 changes: 7 additions & 7 deletions Tests/SwiftyChronoTests/JS/de/test_de_casual.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ test("Test - Single Expression", function() {
ok(result.start.get('year') == 2012, 'Test Result - (Year) ' + JSON.stringify(result.start) );
ok(result.start.get('month') == 8, 'Test Result - (Month) ' + JSON.stringify(result.start) );
ok(result.start.get('day') == 10, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 6, 'Test Result - (hour) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 6, 'Test Result - (Hour) ' + JSON.stringify(result.start) );

var resultDate = result.start.date();
var expectDate = new Date(2012, 7, 10, 6);
Expand All @@ -138,7 +138,7 @@ test("Test - Single Expression", function() {
ok(result.start.get('year') == 2012, 'Test Result - (Year) ' + JSON.stringify(result.start) );
ok(result.start.get('month') == 8, 'Test Result - (Month) ' + JSON.stringify(result.start) );
ok(result.start.get('day') == 10, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 15, 'Test Result - (hour) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 15, 'Test Result - (Hour) ' + JSON.stringify(result.start) );

var resultDate = result.start.date();
var expectDate = new Date(2012, 7, 10, 15);
Expand All @@ -160,7 +160,7 @@ test("Test - Single Expression", function() {
ok(result.start.get('year') == 2012, 'Test Result - (Year) ' + JSON.stringify(result.start) );
ok(result.start.get('month') == 8, 'Test Result - (Month) ' + JSON.stringify(result.start) );
ok(result.start.get('day') == 10, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 18, 'Test Result - (hour) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 18, 'Test Result - (Hour) ' + JSON.stringify(result.start) );

var resultDate = result.start.date();
var expectDate = new Date(2012, 7, 10, 18);
Expand All @@ -186,7 +186,7 @@ test("Test - Combined Expression", function() {
ok(result.start.get('year') == 2012, 'Test Result - (Year) ' + JSON.stringify(result.start) );
ok(result.start.get('month') == 8, 'Test Result - (Month) ' + JSON.stringify(result.start) );
ok(result.start.get('day') == 10, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 17, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 17, 'Test Result - (Hour) ' + JSON.stringify(result.start) );

var resultDate = result.start.date();
var expectDate = new Date(2012, 7, 10, 17);
Expand All @@ -211,7 +211,7 @@ test("Test - Casual date range", function() {
ok(result.start.get('year') == 2012, 'Test Result - (Year) ' + JSON.stringify(result.start) );
ok(result.start.get('month') == 8, 'Test Result - (Month) ' + JSON.stringify(result.start) );
ok(result.start.get('day') == 4, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 12, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 12, 'Test Result - (Hour) ' + JSON.stringify(result.start) );

var resultDate = result.start.date();
var expectDate = new Date(2012, 7, 4, 12);
Expand All @@ -222,7 +222,7 @@ test("Test - Casual date range", function() {
ok(result.end.get('year') == 2012, 'Test Result - (Year) ' + JSON.stringify(result.start) );
ok(result.end.get('month') == 8, 'Test Result - (Month) ' + JSON.stringify(result.start) );
ok(result.end.get('day') == 10, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.end.get('hour') == 12, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.end.get('hour') == 12, 'Test Result - (Hour) ' + JSON.stringify(result.start) );

var resultDate = result.end.date();
var expectDate = new Date(2012, 7, 10, 12);
Expand All @@ -245,7 +245,7 @@ test("Test - Casual date range", function() {
ok(result.start.get('year') == 2012, 'Test Result - (Year) ' + JSON.stringify(result.start) );
ok(result.start.get('month') == 8, 'Test Result - (Month) ' + JSON.stringify(result.start) );
ok(result.start.get('day') == 10, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 12, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 12, 'Test Result - (Hour) ' + JSON.stringify(result.start) );

var resultDate = result.start.date();
var expectDate = new Date(2012, 7, 10, 12);
Expand Down
6 changes: 3 additions & 3 deletions Tests/SwiftyChronoTests/JS/de/test_de_little_endian.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ test("Test - Single expression", function() {
ok(result.start.get('year') == 2013, 'Test Result - (Year) ' + JSON.stringify(result.start) );
ok(result.start.get('month') == 1, 'Test Result - (Month) ' + JSON.stringify(result.start) );
ok(result.start.get('day') == 10, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.start.get('weekday') == 2, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.start.get('weekday') == 2, 'Test Result - (Weekday) ' + JSON.stringify(result.start) );

var resultDate = result.start.date();
var expectDate = new Date(2013, 1-1, 10, 12);
Expand All @@ -154,7 +154,7 @@ test("Test - Single expression", function() {
ok(result.start.get('year') == 2013, 'Test Result - (Year) ' + JSON.stringify(result.start) );
ok(result.start.get('month') == 1, 'Test Result - (Month) ' + JSON.stringify(result.start) );
ok(result.start.get('day') == 10, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.start.get('weekday') == 2, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.start.get('weekday') == 2, 'Test Result - (Weekday) ' + JSON.stringify(result.start) );

var resultDate = result.start.date();
var expectDate = new Date(2013, 1-1, 10, 12);
Expand Down Expand Up @@ -368,7 +368,7 @@ test("Test - Combined expression", function() {
ok(result.start.get('year') == 2012, 'Test Result - (Year) ' + JSON.stringify(result.start) );
ok(result.start.get('month') == 5, 'Test Result - (Month) ' + JSON.stringify(result) );
ok(result.start.get('day') == 7, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 11, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 11, 'Test Result - (Hour) ' + JSON.stringify(result.start) );

var resultDate = result.start.date();
var expectDate = new Date(2012, 5-1, 7, 11, 0);
Expand Down
36 changes: 18 additions & 18 deletions Tests/SwiftyChronoTests/JS/de/test_de_time_ago.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ test("Test - Single Expression", function() {
if(result){
ok(result.index == 0, 'Wrong index');
ok(result.text == 'vor 15 Minuten', result.text );
ok(result.start.get('hour') == 11, 'Test Result - (Month) ' + JSON.stringify(result.start) );
ok(result.start.get('minute') == 59, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 11, 'Test Result - (Hour) ' + JSON.stringify(result.start) );
ok(result.start.get('minute') == 59, 'Test Result - (Minute) ' + JSON.stringify(result.start) );

var resultDate = result.start.date();
var expectDate = new Date(2012,7,10,11,59);
Expand All @@ -64,8 +64,8 @@ test("Test - Single Expression", function() {
if(result){
ok(result.index == 3, 'Wrong index');
ok(result.text == 'vor 12 Stunden', result.text );
ok(result.start.get('hour') == 0, 'Test Result - (Month) ' + JSON.stringify(result.start) );
ok(result.start.get('minute') == 14, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 0, 'Test Result - (Hour) ' + JSON.stringify(result.start) );
ok(result.start.get('minute') == 14, 'Test Result - (Minute) ' + JSON.stringify(result.start) );

var resultDate = result.start.date();
var expectDate = new Date(2012,7,10,0,14);
Expand All @@ -80,8 +80,8 @@ test("Test - Single Expression", function() {
if(result){
ok(result.index == 3, 'Wrong index');
ok(result.text == 'vor einer halben Stunde', result.text );
ok(result.start.get('hour') == 11, 'Test Result - (Month) ' + JSON.stringify(result.start) );
ok(result.start.get('minute') == 44, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 11, 'Test Result - (Hour) ' + JSON.stringify(result.start) );
ok(result.start.get('minute') == 44, 'Test Result - (Minute) ' + JSON.stringify(result.start) );

var resultDate = result.start.date();
var expectDate = new Date(2012,7,10,11,44);
Expand All @@ -97,8 +97,8 @@ test("Test - Single Expression", function() {
if(result){
ok(result.index == 0, 'Wrong index');
ok(result.text == 'Vor 12 Stunden', result.text );
ok(result.start.get('hour') == 0, 'Test Result - (Month) ' + JSON.stringify(result.start) );
ok(result.start.get('minute') == 14, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 0, 'Test Result - (Hour) ' + JSON.stringify(result.start) );
ok(result.start.get('minute') == 14, 'Test Result - (Minute) ' + JSON.stringify(result.start) );

var resultDate = result.start.date();
var expectDate = new Date(2012,7,10,0,14);
Expand All @@ -114,9 +114,9 @@ test("Test - Single Expression", function() {
if(result){
ok(result.index == 0, 'Wrong index');
ok(result.text == 'vor 12 Sekunden', result.text );
ok(result.start.get('hour') == 12, 'Test Result - (Month) ' + JSON.stringify(result.start) );
ok(result.start.get('minute') == 13, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.start.get('second') == 48, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 12, 'Test Result - (Hour) ' + JSON.stringify(result.start) );
ok(result.start.get('minute') == 13, 'Test Result - (Minute) ' + JSON.stringify(result.start) );
ok(result.start.get('second') == 48, 'Test Result - (Second) ' + JSON.stringify(result.start) );

var resultDate = result.start.date();
var expectDate = new Date(2012, 7, 10, 12, 13, 48);
Expand All @@ -132,9 +132,9 @@ test("Test - Single Expression", function() {
if(result){
ok(result.index == 0, 'Wrong index');
ok(result.text == 'vor 3 Sekunden', result.text );
ok(result.start.get('hour') == 12, 'Test Result - (Month) ' + JSON.stringify(result.start) );
ok(result.start.get('minute') == 13, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.start.get('second') == 57, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 12, 'Test Result - (Hour) ' + JSON.stringify(result.start) );
ok(result.start.get('minute') == 13, 'Test Result - (Minute) ' + JSON.stringify(result.start) );
ok(result.start.get('second') == 57, 'Test Result - (Second) ' + JSON.stringify(result.start) );

var resultDate = result.start.date();
var expectDate = new Date(2012, 7, 10, 12, 13, 57);
Expand Down Expand Up @@ -171,8 +171,8 @@ test("Test - Single Expression", function() {
if(result){
ok(result.index == 3, 'Wrong index');
ok(result.text == 'vor einer halben Stunde', result.text );
ok(result.start.get('hour') == 11, 'Test Result - (Month) ' + JSON.stringify(result.start) );
ok(result.start.get('minute') == 44, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 11, 'Test Result - (Hour) ' + JSON.stringify(result.start) );
ok(result.start.get('minute') == 44, 'Test Result - (Minute) ' + JSON.stringify(result.start) );

var resultDate = result.start.date();
var expectDate = new Date(2012,7,10,11,44);
Expand Down Expand Up @@ -208,8 +208,8 @@ test("Test - Single Expression", function() {
if(result){
ok(result.index == 0, 'Wrong index');
ok(result.text == 'vor einer Minute', result.text );
ok(result.start.get('hour') == 12, 'Test Result - (Month) ' + JSON.stringify(result.start) );
ok(result.start.get('minute') == 13, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 12, 'Test Result - (Hour) ' + JSON.stringify(result.start) );
ok(result.start.get('minute') == 13, 'Test Result - (Minute) ' + JSON.stringify(result.start) );

var resultDate = result.start.date();
var expectDate = new Date(2012,7,10,12,13);
Expand Down
16 changes: 8 additions & 8 deletions Tests/SwiftyChronoTests/JS/en/test_en_casual.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ test("Test - Single Expression", function() {
ok(result.start.get('year') == 2012, 'Test Result - (Year) ' + JSON.stringify(result.start) );
ok(result.start.get('month') == 8, 'Test Result - (Month) ' + JSON.stringify(result.start) );
ok(result.start.get('day') == 9, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 0, 'Test Result - (hour) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 0, 'Test Result - (Hour) ' + JSON.stringify(result.start) );

var resultDate = result.start.date();
var expectDate = new Date(2012, 7, 9, 0);
Expand All @@ -132,7 +132,7 @@ test("Test - Single Expression", function() {
ok(result.start.get('year') == 2012, 'Test Result - (Year) ' + JSON.stringify(result.start) );
ok(result.start.get('month') == 8, 'Test Result - (Month) ' + JSON.stringify(result.start) );
ok(result.start.get('day') == 10, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 6, 'Test Result - (hour) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 6, 'Test Result - (Hour) ' + JSON.stringify(result.start) );

var resultDate = result.start.date();
var expectDate = new Date(2012, 7, 10, 6);
Expand All @@ -153,7 +153,7 @@ test("Test - Single Expression", function() {
ok(result.start.get('year') == 2012, 'Test Result - (Year) ' + JSON.stringify(result.start) );
ok(result.start.get('month') == 8, 'Test Result - (Month) ' + JSON.stringify(result.start) );
ok(result.start.get('day') == 10, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 15, 'Test Result - (hour) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 15, 'Test Result - (Hour) ' + JSON.stringify(result.start) );

var resultDate = result.start.date();
var expectDate = new Date(2012, 7, 10, 15);
Expand All @@ -174,7 +174,7 @@ test("Test - Single Expression", function() {
ok(result.start.get('year') == 2012, 'Test Result - (Year) ' + JSON.stringify(result.start) );
ok(result.start.get('month') == 8, 'Test Result - (Month) ' + JSON.stringify(result.start) );
ok(result.start.get('day') == 10, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 18, 'Test Result - (hour) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 18, 'Test Result - (Hour) ' + JSON.stringify(result.start) );

var resultDate = result.start.date();
var expectDate = new Date(2012, 7, 10, 18);
Expand Down Expand Up @@ -223,7 +223,7 @@ test("Test - Casual date range", function() {
ok(result.start.get('year') == 2012, 'Test Result - (Year) ' + JSON.stringify(result.start) );
ok(result.start.get('month') == 8, 'Test Result - (Month) ' + JSON.stringify(result.start) );
ok(result.start.get('day') == 4, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 12, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 12, 'Test Result - (Hour) ' + JSON.stringify(result.start) );

var resultDate = result.start.date();
var expectDate = new Date(2012, 7, 4, 12);
Expand All @@ -234,7 +234,7 @@ test("Test - Casual date range", function() {
ok(result.end.get('year') == 2012, 'Test Result - (Year) ' + JSON.stringify(result.start) );
ok(result.end.get('month') == 8, 'Test Result - (Month) ' + JSON.stringify(result.start) );
ok(result.end.get('day') == 10, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.end.get('hour') == 12, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.end.get('hour') == 12, 'Test Result - (Hour) ' + JSON.stringify(result.start) );

var resultDate = result.end.date();
var expectDate = new Date(2012, 7, 10, 12);
Expand All @@ -256,7 +256,7 @@ test("Test - Casual date range", function() {
ok(result.start.get('year') == 2012, 'Test Result - (Year) ' + JSON.stringify(result.start) );
ok(result.start.get('month') == 8, 'Test Result - (Month) ' + JSON.stringify(result.start) );
ok(result.start.get('day') == 10, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 12, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.start.get('hour') == 12, 'Test Result - (Hour) ' + JSON.stringify(result.start) );

var resultDate = result.start.date();
var expectDate = new Date(2012, 7, 10, 12);
Expand All @@ -267,7 +267,7 @@ test("Test - Casual date range", function() {
ok(result.end.get('year') == 2012, 'Test Result - (Year) ' + JSON.stringify(result.start) );
ok(result.end.get('month') == 8, 'Test Result - (Month) ' + JSON.stringify(result.start) );
ok(result.end.get('day') == 17, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.end.get('hour') == 12, 'Test Result - (Day) ' + JSON.stringify(result.start) );
ok(result.end.get('hour') == 12, 'Test Result - (Hour) ' + JSON.stringify(result.start) );

var resultDate = result.end.date();
var expectDate = new Date(2012, 7, 17, 12);
Expand Down
Loading