week

Hi

How do I get the weeknumber?

ri: today.weeknum # activesupport # does not work?
today.wnum0, .wnum1 # none of these are implemented??

YES, if its Monday of the first week, we could instead use today.wday
... ;))
(So tests sometimes don't help much!)

thank you
Opti

irb(main):013:0> DateTime.now.to_date.cweek
=> 52
irb(main):014:0>

The docs are pretty useful, BTW :slight_smile:

···

On Mon, Dec 27, 2021 at 4:11 AM Die Optimisten <inform@die-optimisten.net> wrote:

How do I get the weeknumber?

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
twitter: @hassan
Consulting Availability : Silicon Valley or remote

> How do I get the weeknumber?

irb(main):013:0> DateTime.now.to_date.cweek
=> 52

Why do you insert ".to_date"?

irb(main):001:0> DateTime.now.cweek
=> 52
irb(main):002:0> Date.today.cweek
=> 52

irb(main):014:0>

The docs are pretty useful, BTW :slight_smile:

Yes, amazing, isn't it. :wink:

Cheers

robert

···

On Mon, Dec 27, 2021 at 8:56 PM Hassan Schroeder <hassan.schroeder@gmail.com> wrote:

On Mon, Dec 27, 2021 at 4:11 AM Die Optimisten > <inform@die-optimisten.net> wrote:

--
[guy, jim, charlie, sho].each {|him| remember.him do |as, often| as.you_can
- without end}
http://blog.rubybestpractices.com/

1. Force of habit
2. Thinking in terms of types and pipelines, since I mostly do Elixir
     work now :grinning:

But you're correct, it's unnecessary
.

···

On Wed, Dec 29, 2021 at 3:18 AM Robert Klemme <shortcutter@googlemail.com> wrote:

irb(main):013:0> DateTime.now.to_date.cweek
=> 52

Why do you insert ".to_date"?

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
twitter: @hassan
Consulting Availability : Silicon Valley or remote