Giter Site home page Giter Site logo

moment-jdateformatparser's People

Contributors

gboros avatar haidy777 avatar herom avatar jeffborders avatar madmg avatar zhaozhiming 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

Watchers

 avatar  avatar  avatar  avatar  avatar

moment-jdateformatparser's Issues

webpack cannot statically wire moment

Hi,
When using moment-jdateformatparser with webpack, webpack throws an error in the section where moment-jdateformatparser is trying to determine whether the environment is node or AMD.

not sure about a solution but i thought i would send you guys a heads up about it

here is the warning as it comes from webpack
WARNING in .//moment-jdateformatparser/moment-jdateformatparser.js
Critical dependencies:
163:78-85 require function is used in a way in which dependencies cannot be statically extracted
@ ./
/moment-jdateformatparser/moment-jdateformatparser.js 163:78-85

Using 'yyy' in formatString

Hi,
I used "yyy" in my java code, it works like that (99 -> 099 , 999-> 999 , 9999->9999).
can you please provide a way to Map 'yyy' in momentjs?

thanks

Loading with Require.js doesn't always work as expected

I'm using the following code to load moment-jdateformatparser:

require.config({
  paths: {
    'moment': 'path/to/moment',
    'moment-jdateformatparser': 'path/to/moment-jdateformatparser'
  },
  shim: {
    'moment-jdateformatparser': ['moment']
  }
});

require(['moment', 'moment-jdateformatparser'], function(moment) {
  moment().toMomentFormatString('yyyy/MM/dd HH:mm');
});

This fails from time to time complaining that toMomentFormatString is not available. It happens most often on IE11. The issue is that moment-jdateformatparser extends moment using a Require.js callback when require is available (even if moment was previously loaded). Require.js doesn't call the callback immediately but on the next processor cycle (think about setTimeout(0)) even if the required module is already loaded. Thus you have to do this to make it work, which is cumbersome:

require(['moment-jdateformatparser'], function() {
  // moment-jdateformatparser was loaded but it didn't extend moment yet.
  // We need to put our code in a require callback in order to wait for
  // moment-jdateformatparser to extend moment.
  require(['moment'], function(moment) {
    moment().toMomentFormatString('yyyy/MM/dd HH:mm');
  });
});

toMomentFormatString function with node v6.7.0

Hi. Are there some issues with node 6?
I'm trying to run code

require('moment-jdateformatparser');
(0, _moment2.default)().toMomentFormatString(format);

but getting error TypeError: (0 , _moment2.default)().toMomentFormatString is not a function

Code (0 , _moment2.default)() returns object of type 'Moment'.

Uncaught ReferenceError: module is not defined

Using the version 1.1.0 of jdateformatparser with requirejs (using requirejs 2.3.2 on my side) results in an Uncaught ReferenceError on execution of the module in line 181:

Uncaught ReferenceError: module is not defined
    at moment-jdateformatparser.js:181
    at moment-jdateformatparser.js:250

This is broken since the check for module was changed with this commit from

if (typeof module !== 'undefined' && typeof module.exports !== 'undefined')

to

if (module && module.exports)

Quoted strings

Quoted strings are interpret incorrectly.

SimpleDateFormat:

System.out.println(new SimpleDateFormat("d.' of 'MMM").format(new Date()));

prints out _14. of Feb_ when:

console.log(moment().formatWithJDF("d.' of 'MMM")); 

prints _14.' of 'Feb_

Doesn't support moment timezone well

when I call time.tz(""America/New_York"").formatWithJDF("yyyy/MM/dd HH:mm:ss z"), I got this:
2018/06/01 08:00:00 -0400
which I expected:
2018/06/01 08:00:00 EDT

Single 'y' representation of year

Hi,

I recently found that after an upgrade to Angular 1.3.9 some of the standard AngularJS $locale DATETIME_FORMATS were no longer converting properly to the moment equivalent. It turns out that many of the DATETIME_FORMATS strings were converted to use the single 'y' representation of the year instead of the 'yyyy'.

It seems a little odd but unlike the 'yy' string, this should result in full display of the year (just with no padding 0s for years of fewer than 4 digits).

From the angular locale docs:
'y': 1 digit representation of year, e.g. (AD 1 => 1, AD 199 => 199)

It appears that SimpleDateFormat exhibits the same behaviour.

It looks like there isn't an exact equivalent of 'y' in momentjs format strings but the addition of the javaFormatMapping - y: 'YYYY' might provide an approximation.

Thanks

momentjs.fn is not defined.

Hi Team,
I use the latest package in angular 6.
npm install moment-jdateformatparser.
But i got error with momentjs.fn is not defined when testing with simple format:
moment().formatWithJDF('DD');
I am not sure if the import is wrong:
import * as moment from 'moment-jdateformatparser';
I am at your disposal.

Support for k,K

Hi,

Any chance you can add support for k and K?

H Hour in day (0-23) Number 0
k Hour in day (1-24) Number 24
K Hour in am/pm (0-11) Number 0
h Hour in am/pm (1-12) Number 12

Adding an image to the string date returns invalid date

I am getting the date as: ex: 3/11/2011

I am assigning a bunch of dates into an array "U" and then dumping it into a datable.
var resolution = moment(data.d.results[u].Resolution_x0020_Due).format('l hh:mm A');

data.d.results[u].Resolution_x0020_Due = resolution + " < img style='padding-left: 20px;' title='SLA is currently on time' src='sla_good.png'/ > ";

When I want to add and image to that string it returns invalid date. Is there a way to add an image without getting invalid date back?

After 1.2.0 update getting TypeError: moment(...).formatWithJDF is not a function breaking builds

repl: https://repl.it/@marcusmotill/moment-jdateformatparser-bug

code:

let moment = require('moment');
let momentJdateformatparser = require('moment-jdateformatparser');

console.log(moment().formatWithJDF("dd.MM.yyyy"))

output:

+ [email protected]
+ [email protected]
added 3 packages in 1.998s


Repl.it: package installation success

TypeError: moment(...).formatWithJDF is not a function
    at evalmachine.<anonymous>:4:22
    at Script.runInContext (vm.js:74:29)
    at Object.runInContext (vm.js:182:6)
    at evaluate (/run_dir/repl.js:137:14)
    at Socket.<anonymous> (/run_dir/repl.js:120:5)
    at Socket.emit (events.js:180:13)
    at addChunk (_stream_readable.js:274:12)
    at readableAddChunk (_stream_readable.js:261:11)
    at Socket.Readable.push (_stream_readable.js:218:10)
    at Pipe.onread (net.js:581:20)

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.