Giter VIP home page Giter VIP logo

Comments (13)

 avatar commented on July 22, 2024 1

This is a much needed feature... any ETA?

My use case: "Last day of next month"

Expected: If today is 14 Feb 2019 -> 31 March 2019

from chronic.

leejarvis avatar leejarvis commented on July 22, 2024

There's currently no way of interpreting last as the end of a month. Chronic doesn't contain a month day lookup table except for when constructing Time objects, which is too low level for this. I've labeled this as a feature though, I think it's a great idea.

from chronic.

jeremywadsack avatar jeremywadsack commented on July 22, 2024

How about last day of a month is first day of the next month minus one day? In other words, use the month day lookup that's built into ruby / the OS.

from chronic.

rurounijones avatar rurounijones commented on July 22, 2024

That is what I ended up doing for that particular case instead of usng Chronic.

from chronic.

leejarvis avatar leejarvis commented on July 22, 2024

@jeremywadsack Yeah that was my intention for this. Just haven't found time to get around to it yet.

from chronic.

semperos avatar semperos commented on July 22, 2024

It would also be great to have "Last Monday in May" logic (this is US Memorial Day).

from chronic.

tamouse avatar tamouse commented on July 22, 2024

+1 for last weekday of month. Currently doing this:

d = ((x = Chronic::parse("fifth Monday in May")).nil?) ? (Chronic::parse("fourth Monday in May)) : x

from chronic.

jaredbrown avatar jaredbrown commented on July 22, 2024

+1 for last weekday of month

from chronic.

timfong888 avatar timfong888 commented on July 22, 2024

+1 last day of the month

from chronic.

kovpack avatar kovpack commented on July 22, 2024

+1 last day of the month

from chronic.

shrav avatar shrav commented on July 22, 2024

+1 last day of the month

from chronic.

zedtux avatar zedtux commented on July 22, 2024

+1

from chronic.

zedtux avatar zedtux commented on July 22, 2024

Here is how I did it based on @jeremywadsack's comment:

Chronic.parse('1st day next month') - 1.day

from chronic.

Related Issues (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.