Selecting date in celander is giving me previous date using Vurig-Calendar Library in iOS

StackOverflow https://stackoverflow.com/questions/15065232

  •  11-03-2022
  •  | 
  •  

سؤال

I have downloaded this library https://github.com/TjeerdVurig/Vurig-Calendar. Now the problem which I'm facing, for example if I select 25th feb 2013 it is printing 24th Feb 2013. I Can't find anything in code. Is it because of time zone or something that is not related with coding?? Please Advise

Thanks

هل كانت مفيدة؟

المحلول

You have problems with time zone and it can be solved by adding this line of code:

[formatter setTimeZone:[NSTimeZone timeZoneWithName:@"GMT"]];

Update

  1. Question 1

  2. Question 2

  3. Question 3

نصائح أخرى

That is very easy to do. In your VRGCalendarView.m go to method

- (void)drawRect:(CGRect)rect {
    int firstWeekDay = [self.currentMonth firstWeekDayInMonth]-1;
}

Change this to :

int firstWeekDay = [self.currentMonth firstWeekDayInMonth];

and

int selectedDateBlock = ([selectedDate day]-1)+firstWeekDay;

change this one to

int selectedDateBlock = ([selectedDate day]-2)+firstWeekDay;
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top