Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    iamkun
    @iamkun
    hi
    xxyuk
    @xxyuk
    wow a chat room
    Arnau Lacambra
    @naulacambra
    Hi! Nice to have this to talk with you all :grin:
    hosung
    @y0c
    Hi, Can I know when the 1.8.12 version will be released?
    Arnau Lacambra
    @naulacambra
    @y0c which feature do you need?
    hosung
    @y0c
    @naulacambra It's a simple function. locale change. iamkun/dayjs#543
    Arnau Lacambra
    @naulacambra
    @y0c I see, meanwhile, you can load your own locale file, until new version is released
    iamkun
    @iamkun
    Hi! all
    @y0c yes, you can load your own locale file before next release
    Olivia Zhang
    @oliv9286
    hello ^^ are there any alternatives for moement/weekday? https://momentjs.com/docs/#/get-set/weekday/
    iamkun
    @iamkun
    @oliv9286 No at this time. But we are happy to support this by creating a new plugin. Can you provide some real use case of this API, please?
    Olivia Zhang
    @oliv9286
    @iamkun to be honest I don't have a direct use for it myself, it's more about migrating to moment to dayjs. Moment is massive and cannot be tree shaken. For the code that's in my project, I can replace moment and use alternative dayjs functions. But my project also uses a 3rd party dep -- react-dates which is dependent on moment, and they use this weekday function, the migration becomes tricky because moment and dayjs's APIs don't fully match (airbnb/react-dates#1294). As far as I understand it just does what day() does but is locale aware. Do you have any recommendations on migration strategies from moment to dayjs?
    iamkun
    @iamkun
    Oh I see, you may could open an issue detailing this problem, and we will do it right away.
    hosung
    @y0c

    Hi, dayjs parse doesn't work as i expected

    // work 
    dayjs('2019-04-03 10:44 AM', 'YYYY-MM-DD HH:mm A)
    // not work 
    dayjs('2019-04-03 22:44 PM', 'YYYY-MM-DD HH:mm A)

    Am I using it wrong?

    hosung
    @y0c
    sorry, i solved it through customParseFormat plugin
    iamkun
    @iamkun
    cool~
    Olivia Zhang
    @oliv9286
    @iamkun issue opened for weekday() alternative - iamkun/dayjs#559. Would love to help contribute to this project so that we're not all stuck with a massive non-treeshakable dependency ^^ Thank you
    iamkun
    @iamkun
    Thanks, I will deal with this issue shortly. Fell free to send us any PR if you want.
    Alchemist
    @yunyu950908

    Hi, I have a usage problem
    https://momentjs.com/docs/#/manipulating/utc-offset/

    moment.unix(timestamp).utcOffset("+08:00").format(string)

    I used to format time by this function in moment, but dayjs cannot pass offset value in function utcOffset

    xxyuk
    @xxyuk
    Yes, set utcOffset is not supported in Day.js
    Roberto Wesley Overdijk
    @RWOverdijk
    Good day(js)!
    Quick question... I'm trying to use the calendar plugin but I noticed that not all strings are translated, causing gorgeous strings such as "Last maandag".
    Is there a way for me to translate "Last"? I don't mind contributing translations.
    iamkun
    @iamkun
    Check calendar plugin's doc
    you can pass your custom translated locale object as the second argument
    @RWOverdijk
    Roberto Wesley Overdijk
    @RWOverdijk
    Yeah that's not good enough. I use this method quite a lot and passing it in everywhere defeats the purpose of having locales configured :smile:
    Also not in line with the other plugins that do it properly, like relativeTime
    @iamkun I suggest letting it read from translations, too. It does that already, sort of. But the calendar plugin isn't part of locales yet.
    Also, I suggest falling back to translations regardless and do it like relativeTime does it (https://github.com/iamkun/dayjs/blob/dev/src/plugin/relativeTime/index.js#L5)
    Roberto Wesley Overdijk
    @RWOverdijk
    @iamkun I'm willing to get my hands dirty (not just complain). I have the translations ready for nl and pt-br so if I can PR those I'm game.
    iamkun
    @iamkun
    OK . Nice job. I'll comment to that PR instead.
    mon
    @monw3c
    hi @iamkun ,请问有没有api可以查询当前月日的前一个月日呢?
    iamkun
    @iamkun
    @monw3c dayjs().subtract(1, 'month')
    Tony Hudson
    @ngohungphuc
    Hi guys i have a question here. Can someone take a look at it iamkun/dayjs#593
    many thank
    Matt Pilott
    @matt3224
    Hello
    How can i know if the day i'm on is a saturday or sunday?
    iamkun
    @iamkun
    @matt3224 dayjs().day() === 6
    Ronny Hanssen
    @Spiralis
    Hi guys. I am new to day.js, but it seems like it could be a good fit for me.
    I am creating a library that other web-apps will be using. The most common use-case is for the library to be consumed via a script-tag in the browser, where they would then initialize the library.
    I have two questions:
    1. I want the end-users to be able to get the dates I use via day.js in their native language (when day.js supports it). But, I am worried about importing all locales before I build the script, as the resulting library would be way larger than ideal/necessary.
    2. Since day.js doesn't support timezones, would I have to detect the users timezone and convert that to/from UTC (as the backend will always use UTC)
    Ronny Hanssen
    @Spiralis
    I think I can perhaps load the locales dynamically from the CDN, perhaps? But, if my main library is loaded via npm, how can I then add dynamically loaded locales from CDN to the days instance? Is there an API for that?
    iamkun
    @iamkun
    @Spiralis Day.js will use user's current timezone. But you can also use UTC plugin to force get UTC time.
    Dynamic loading should be implemented in your js logic code not a Day.js feature.