Code Monkey home page Code Monkey logo

scala-js-momentjs's Introduction

Moment.js façade for Scala.js

Maven Central Scala.js

Installation

Add the following dependency to your build.sbt:

libraryDependencies +=
  "ru.pavkin" %%% "scala-js-momentjs" % "0.10.9"

Since 0.9.0 scala-js-momentjs can be used with scalajs-bundler.

Example

import moment._

Moment.locale("en_GB")

Moment().calendar()
Moment(millis).calendar()
Moment(millis).fromNow()

Versions 0.2.0 and earlier

If for some reason you want to use version prior to 0.3.1, then use following examples to import and use the facade:

libraryDependencies +=
  "io.github.widok" %%% "scala-js-momentjs" % "0.2.0"
import org.widok.moment._

Moment()

Versions of Moment.js

Facade Moment.js Moment-timezone Scala versions Scala.js version
0.10.9 >=2.29.4 0.5.40 2.13 1.12.0
0.10.8 2.22.2 0.5.35 2.13 1.10.1
0.10.7 2.22.2 0.5.34 2.13 1.10.1
0.10.5 2.22.2 0.5.31 2.12.11, 2.13.2 1.2.0
0.10.4 2.22.2 0.5.28 2.12.11, 2.13.2 0.6.32, 1.0.1
0.10.3 2.22.2 0.5.25 2.12.10, 2.13.0 0.6.32, 1.0.0
0.10.2 (broken) 2.22.2 0.5.25 2.12.10, 2.13.0 0.6.32, 1.0.0
0.10.1 2.22.2 0.5.25 2.12.10, 2.13.0 0.6.31, 1.0.0-RC1
0.10.0 2.22.2 0.5.25 2.11.12, 2.12.8, 2.13.0 0.6.x
0.9.1 2.19.2 0.5.14 2.11.11, 2.12.4 0.6.x
0.9.0 2.18.1 0.5.13 2.11.11, 2.12.2 0.6.x
0.8.* 2.18.1 0.5.11 2.11.11, 2.12.2 0.6.x
0.7.0 2.18.1 0.5.11 2.11.8, 2.12.1 0.6.x
0.6.0 2.18.0 0.5.11 2.11.8, 2.12.1 0.6.x
0.5.1 2.17.1 0.5.11 2.11.8, 2.12.1 0.6.x
0.5.0 2.17.1 0.5.11 2.11.8, 2.12.1 0.6.x
0.4.1 2.16.0 0.5.9 2.11.8, 2.12.0 0.6.x
0.4.0 2.16.0 0.5.9 2.11.8 0.6.x
0.3.3 2.15.2 0.5.5 2.11.8 0.6.x
0.3.2 2.15.1 0.5.5 2.11.8 0.6.x
0.3.1 2.15.1 0.5.5 2.11.8 0.6.x

License

This façade is licensed under the terms of the Apache v2.0 license.

Authors

  • Tim Nieradzik
  • Erik LaBianca
  • Vladimir Pavkin

scala-js-momentjs's People

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scala-js-momentjs's Issues

Bump to scala.js 1.0.0

Request for a version. If there are no API changes, maybe just use 1.0..0 going forward.

I think 1.0.0 goes final by end of Jan. Right now it's at RC2.

I saw the M8 cross.

Wrapper for use in shared JS/JVM projects?

Wouldn't it be cool if the facade could be used in cross projects and not just in Scala.JS only projects?

We would need some kind of wrapper for this purpose. Either a wrapper for Moment.js using java.time in the JVM or a wrapper of java.time (or joda time or whatever) using Moment.js in the JS part.

There is already https://github.com/zoepepper/scalajs-jsjoda and https://github.com/cquiroz/scala-java-time for this purpose, but both have some problems at the moment. The first one is very incomplete and the second one has very limited support for Locales and time zones.
Moment.js, in contrast, seems to be quite complete.

Missing JS library

After a clean build I suddenly get the following errors at compile time:

org.scalajs.core.tools.jsdep.JSLibResolveException: Some references to JS libraries could not be resolved:
- Missing JS library: moment/2.15.1/min/moment-with-locales.js
  originating from: scalaJsMomentJs:compile
- Missing JS library: 2.15.1/min/moment-with-locales.js
  originating from: scalaJsMomentJs:compile

Release version 0.2.0

Sorry for being annoying, but I have some really active development in progress, that depends on this facade, and a release with all recent fixes would really help.

Since #21 is a breaking change, this should probably be 0.2.0

If there's anything I can do to help with release, just tell :)

Compatibility with scalajs-bundler?

I've started to use scalajs-bundler in my project, and all of a sudden this wrapper doesn't work anymore. I get error messages like Uncaught TypeError: Cannot read property 'utc' of undefined. Looks like the related javascript file is not loaded. Has anyone tried using this with scalajs-bundler before?

Unable to obtain timezone data

A very common use case for this library is obtaining the entire list of time zones along with their corresponding information. Mainly useful in forms where a select field needs to be populated with timezone options. This also requires the moment-timezone-with-data.js file.

The api call for obtaining the list is moment.tz.names().

This currently is not supported here.

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.