You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@daffodil.apache.org by "Costello, Roger L." <co...@mitre.org> on 2020/05/01 15:36:28 UTC

I don't understand the calendar properties!

Hi Folks,

When specifying that a data item has a calendar date/time value, you must specify, among others, these properties:

 - calendarFirstDayOfWeek
 - calendarDaysInFirstWeek

Huh?

Is that the first day of the week and the days in the first week for the current year (2020)? If so, my DFDL schema will break in 2021, right?

Or, is it the first day of the week and the days in the first week for the input value? If so, my DFDL schema will break when I change the input value, right?

I thought I understood the calendar properties, but now realize that I don't. Please help!

/Roger

Re: I don't understand the calendar properties!

Posted by "Beckerle, Mike" <mb...@tresys.com>.
Not for current year.

These are universal rules.

calendarFirstDayOfWeek is usually 'Sunday' around here, but my paychecks are Saturday to Friday weeks.
And, some people use the convention of Monday being first day of the week.

This property comes up when dealing with date information involving numeric days of week information. I.e., the calendarPattern "e" specifier. But it also interacts with calendarDaysInFirstWeek below.

calendarDaysInFirstWeek is a threshold. Let's say your week begins on Sunday, so that's day 1 of a week.
Jan 1 falls on a wednesday some year let's say. So Wed, Thurs, Fri, Sat are 4 days that are in the fraction of a week before the first Sunday. That's 4 days.  If calendarDaysInFirstWeek is 4 or less, then these first 4 days will be considered to be week 1 of the year. Week 2 will begin on Sunday. If calendarDaysInFirstWeek is 5, 6, or 7, then these first 4 days will be considered part of the final week of the prior year, and the 1st week of this year will be considered to begin on Sunday Jan 5.

Note that this whole calculation is relative to what day of the week you choose to be the first day of the week.


________________________________
From: Costello, Roger L. <co...@mitre.org>
Sent: Friday, May 1, 2020 11:36 AM
To: users@daffodil.apache.org <us...@daffodil.apache.org>
Subject: I don't understand the calendar properties!

Hi Folks,

When specifying that a data item has a calendar date/time value, you must specify, among others, these properties:

 - calendarFirstDayOfWeek
 - calendarDaysInFirstWeek

Huh?

Is that the first day of the week and the days in the first week for the current year (2020)? If so, my DFDL schema will break in 2021, right?

Or, is it the first day of the week and the days in the first week for the input value? If so, my DFDL schema will break when I change the input value, right?

I thought I understood the calendar properties, but now realize that I don't. Please help!

/Roger

Re: I don't understand the calendar properties!

Posted by Steve Lawrence <sl...@apache.org>.
I believe those values are only really used when you specify dates in
different formats that we don't really us in the US. For example, rather
than saying

  Jan 8, 2020

You could alternatively say

  Year 2020, 2nd week of the year, 4th day of the week

But the latter depends on what you consider the first week of the year,
and the first day of the week.

If you consider Sunday the first day, then Jan 8 is the 4th day of the
week, but if you consider Monday the first day of the week, then Jan 8
is the 3rd day of the week. Different calendar systems have different
starts of the week, so these properties support this variability.

Similarly, what do you consider the first week of the year. Is it the
week containing January 1st, or is the first week that is completely in
Janurary (again, depends on first day of week), or somewhere in between.
Again, different calendar systems have different answers for these
questions, which affects these day of week/week of year dates.

On 5/1/20 11:36 AM, Costello, Roger L. wrote:
> Hi Folks,
> 
> When specifying that a data item has a calendar date/time value, you must specify, among others, these properties:
> 
>  - calendarFirstDayOfWeek
>  - calendarDaysInFirstWeek
> 
> Huh?
> 
> Is that the first day of the week and the days in the first week for the current year (2020)? If so, my DFDL schema will break in 2021, right?
> 
> Or, is it the first day of the week and the days in the first week for the input value? If so, my DFDL schema will break when I change the input value, right?
> 
> I thought I understood the calendar properties, but now realize that I don't. Please help!
> 
> /Roger
>