Coder Social home page Coder Social logo

monday's People

Contributors

alexolshanskyy avatar azziko avatar benoit12345 avatar bmarguer avatar braceta avatar ckcks12 avatar eduard-pelivan avatar fbecart avatar goodsign avatar henriklundgren avatar huehnerhose avatar hwsoderlund avatar kardasjan avatar math-nao avatar midiland avatar mikespook avatar mixadior avatar mrgeorgen avatar n-jaisabai avatar pieter-irsan avatar renatomserra avatar rofrol avatar skateinmars avatar smanurung avatar smythey21 avatar suwhs avatar thebaer avatar wybcp avatar yukoff avatar ztstewart avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

monday's Issues

new release

Hi,

Would it be possible to publish a new release? I like your package a lot and am using it in a web scraper project. Among others I'd like to use the locale sk_SK which is already supported by the code but the latest release 1.0.1 does not yet include this locale if I'm not mistaken. It would be awesome if you could publish a new release with the latest changes. Thanks in advance! :)

Cheers, Jakob

Is this Typo?

DefaultFormatSvSEFull = "Mondayen den 2:e January 2006" // Swedish (Sweden)

Im not sure but I think this is a Typo.
Mondayen → Monday

I wanted to Replace "Monday" with "(Mon)" in goodsign/monday/default_formats.go -> FullFormatsByLocale.
But this one seems different style then others.

Avoid dependency on package fatih/set

The package currently depends on package github.com/fatih/set.v0 but it is no longer maintained and could pose a risk for this projects health in case of the repository being deleted.

Would you consider it possible to avoid this dependency over all? It's used in monday.LocaleDetector. After looking breifly in the source code it seems to be possible to replace it with a standard map[string]monday.Locale map?

Errors when parsing Japanese Dates

I am getting a time.ParseError when I run ParseInLocation for dates in Japanese.

Variables:

  • layout = 発売予定日は2006年1月2日です。
  • s = 発売予定日は2020年3月25日です。
  • loc = UTC
  • l = ja_JP

I call the function
t, err = monday.ParseInLocation(layout, s, loc, l)

Error msg:

parsing time "発売予定日は2020年March25日です。" as "発売予定日は2006年1月2日です。": cannot parse "March25日です。" as "1"

Work around:

I comment out line 76-79 in format_ja_jp.go

// for k, v := range knownMonthsLongReverse[locale] {
// value = strings.Replace(value, k, v, -1)
// }

Please let me know if you need any more information.

Thanks,
Luke

Incorect formating with _ at the begining.

day := 10

monday.Format(
	time.Date(2020, time.June, day, 0, 0, 0, 0, time.Local),
	"_2 January 2006", monday.LocalePtPT)

The code above does not translate month on day>=10

Undefined variables

I can't clone this repo with 'go get'. It has undefined variables:

$ go get github.com/goodsign/monday
./monday.go:319: undefined: longDayNamesCsCZ
./monday.go:320: undefined: shortDayNamesCsCZ
./monday.go:321: undefined: longMonthNamesCsCZ
./monday.go:322: undefined: shortMonthNamesCsCZ
./monday.go:323: undefined: longMonthNamesGenitiveCsCZ
./monday.go:324: undefined: shortMonthNamesGenitiveCsCZ

Can you take a look please

Add go modules

Hello,

Could you add go modules in your project ?

Thank you.

PS: And thank you for this amazing library 🙂

Short date.

Hi!

I followed the example, but can't get, how to make date look like "20 may" for "2020-05-20". In particularly I'm interested in Russian version. I tried:

monday.Format(time.Now(), "02 Jan 06 15:04 MST", monday.LocaleRuRU)

but it returns empty string. (But I expect 20 мая 20 15:04 MST)

The format that works is 2006-01-02, but it's not what I want. Could you please elaborate on examples in Readme (because there is only one simple) or point out what I am doing wrong.

Thanks!

Performance improvements

Hi,

Thank you for this project.

I believe some API changes can increase the performance and resource usage. For example, a log file must contain same date layout. Instead of using "Parse" method for each date value, we can detect the locale only one time, and then we can call "ParseInLocation" directly to improve parse process. But right now, locale etc is private fields. So it's not exposed to us, and makes it impossible to change the logic.

If we can make the "LastLocale" field public. after first detection, we can get store the Locale and then call the "ParseInLocation" directly.

Thanks again.

Suggestion: Improve search engine visibility for the package

A few months back I searched around for l10n solutions specifically related to date/time in go. I stumbled upon this package, but cannot remember exactly how I found it. Put it in the back of my mind for later. Today I needed to find it again and started googling. Tried a number of searches and could not find it. First I though it had been removed, but then I remembered that I forked it earlier, and found it that way.

I think you should consider adding some more search-friendly keywords at the top of the readme to increase visibility. Both l10n and i18n should be there I think. Also, I am not quite sure what settings are available on a github repo to allow or disallow indexing by search engines. Perhaps something could be opened up there? During my searching I even tried searching for Swedish month names, but that did not help. So I am guessing that google does not index the source code. This search for example, for the Swedish word for "monday", finds 0 results:

site:github.com/goodsign/monday måndag

Just FYI, here are some of the searches I did, none of which found the monday package:

site:github.com golang "september" "oktober" "november"
go date l10n package
golang date l10n package
golang time l10n package
go time localization package
golang date i18n site:github.com
golang international month names site:github.com
golang international month names```

`text.Scanner` is outputting unnecessary stderr

text.Scanner is outputting errors. Such as:

<input>:1:1: literal not terminated
<input>:1:1: invalid char literal
<input>:1:1: literal not terminated
<input>:1:1: invalid char literal

Such as when I use tokens like '':

		layoutData{
			layout: "' Mon, 2 Jan 2006 15:4:5 -0700",
			matches: []string{
				"' Нд, 22 Гру 2019 00:35:44 +0200",
			},
			unmatches: []string{},
			locales: []Locale{
				LocaleUkUA,
				LocaleRuRU,
				LocaleEnUS,
				LocaleEnUS,
			},
		},

I believe this is because text.Scanner is build to parse go tokens for a compiler.

Which technically means I should be able to break tests by passing in tokens like /* and when it /could/ be a valid format string.

Ie:

package main

import (
	"fmt"
	"github.com/goodsign/monday"
	"time"
)

func main() {
	fmt.Println(time.Parse("/* Mon, 02 Jan 2006 15:04:05 */", "/* Mon, 02 Nov 2007 17:42:36 */"))
	fmt.Println(monday.NewLocaleDetector().Parse("/* Mon, 02 Jan 2006 15:04:05 */", "/* Mon, 02 Nov 2007 17:42:36 */"))
	fmt.Println(time.Parse(".. Mon, 02 Jan 2006 15:04:05 ..", ".. Mon, 02 Nov 2007 17:42:36 .."))
	fmt.Println(monday.NewLocaleDetector().Parse(".. Mon, 02 Jan 2006 15:04:05 ..", ".. Mon, 02 Nov 2007 17:42:36 .."))
}

Outputs:

2007-11-02 17:42:36 +0000 UTC <nil>
0001-01-01 00:00:00 +0000 UTC parsing time "/* Mon, 02 Nov 2007 17:42:36 */"'/* Mon, 02 Nov 2007 17:42:36 */' not matches to '/* Mon, 02 Jan 2006 15:04:05 */' last error position = 0

2007-11-02 17:42:36 +0000 UTC <nil>
2007-11-02 17:42:36 +0000 UTC <nil>

Feature request: support Kazakh locale

Hey! I'm using this package in my project, but unfortunately i didn't find the kazakh locale
it would be great if this package will support kazakh locale

P.S PR is ready

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.